Skip to content

Commit

Permalink
fix: minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammeds1992 committed Sep 29, 2023
1 parent aa93fea commit 12e3ca5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/examples/sdk-backend-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@pushprotocol/restapi": "@latest",
"@pushprotocol/restapi": "0.0.1-alpha.36",
"@pushprotocol/socket": "^0.5.2"
}
}
13 changes: 11 additions & 2 deletions packages/restapi/src/lib/pushstream/DataModifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,17 @@ export class DataModifier {
Reject: MessageEventType.Reject,
};

const eventType: MessageEventType | undefined =
eventTypeMap[data.eventType || data.messageCategory];
const key = data.eventType || data.messageCategory;

if (!eventTypeMap[key]) {
console.error(
'Error in handleChatEvent: Invalid eventType or messageCategory',
JSON.stringify(data)
);
throw new Error('Invalid eventType or messageCategory in data');
}

const eventType: MessageEventType = eventTypeMap[key];

if (eventType) {
return this.mapToMessageEvent(
Expand Down
2 changes: 1 addition & 1 deletion packages/restapi/tests/lib/pushstream/initialize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { STREAM } from '../../../src/lib/pushstream/pushStreamTypes';
import * as util from 'util';
import { ConditionType } from '../../../src/lib';

describe.only('PushStream.initialize functionality', () => {
describe('PushStream.initialize functionality', () => {
it('Should initialize new stream and listen to events', async () => {
const MESSAGE = 'Hey There!!!';

Expand Down

0 comments on commit 12e3ca5

Please sign in to comment.