refactor(service-worker): Code optimizations (#25860)
- Add missing new line in tests - Add proper noop method in MockNotificationEvent PR Close #25860
This commit is contained in:
parent
f5d5a3df59
commit
1aca54da06
|
@ -303,14 +303,15 @@ import {async_fit, async_it} from './async';
|
|||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('messagesClicked', () => {
|
||||
it('receives notification clicked messages', () => {
|
||||
const sendMessage = (type: string, message: string) =>
|
||||
mock.sendMessage({type, data: {message}});
|
||||
const sendMessage = (type: string, action: string) =>
|
||||
mock.sendMessage({type, data: {action}});
|
||||
|
||||
const receivedMessages: string[] = [];
|
||||
push.messagesClicked.subscribe(
|
||||
(msg: {message: string}) => receivedMessages.push(msg.message));
|
||||
(msg: {action: string}) => receivedMessages.push(msg.action));
|
||||
|
||||
sendMessage('NOTIFICATION_CLICK', 'this was a click');
|
||||
sendMessage('NOT_IFICATION_CLICK', 'this was not a click');
|
||||
|
|
|
@ -351,7 +351,7 @@ class MockPushEvent extends MockExtendableEvent {
|
|||
}
|
||||
class MockNotificationEvent extends MockExtendableEvent {
|
||||
constructor(private _notification: any, readonly action?: string) { super(); }
|
||||
readonly notification = {...this._notification, close: () => { return; }};
|
||||
readonly notification = {...this._notification, close: () => undefined};
|
||||
}
|
||||
|
||||
class MockInstallEvent extends MockExtendableEvent {}
|
||||
|
|
Loading…
Reference in New Issue