Skip to content

Commit

Permalink
Return notificationId from postLocalNotification (wix#610)
Browse files Browse the repository at this point in the history
  • Loading branch information
yogevbd authored and xvonabur committed May 13, 2020
1 parent 22eedcb commit d054818
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions lib/src/commands/Commands.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ describe('Commands', () => {
uut.postLocalNotification(notification, passedId);
verify(mockedNativeCommandsSender.postLocalNotification(notification, passedId)).called();
});

it('return notification id', () => {
const notification: Notification = new Notification({identifier: 'id'});
const notificationId: number = 2;
const response = uut.postLocalNotification(notification, notificationId);
expect(response).toEqual(notificationId);
});
});

describe('getBadgeCount', () => {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/commands/Commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export class Commands {

public postLocalNotification(notification: Notification, id?: number) {
const notificationId: number = id ? id : this.uniqueIdProvider.generate();
const result = this.nativeCommandsSender.postLocalNotification(notification, notificationId);
return result;
this.nativeCommandsSender.postLocalNotification(notification, notificationId);
return notificationId;
}

public async getInitialNotification(): Promise<Notification | undefined> {
Expand Down

0 comments on commit d054818

Please sign in to comment.