Fixes silenced notification preventing notification prompt to be shown (#9336)
This commit is contained in:
parent
a704a2fbb7
commit
c2e2f406af
7 changed files with 10 additions and 75 deletions
|
@ -19,7 +19,6 @@ import { mocked } from "jest-mock";
|
|||
|
||||
import {
|
||||
localNotificationsAreSilenced,
|
||||
createLocalNotificationSettingsIfNeeded,
|
||||
getLocalNotificationAccountDataEventType,
|
||||
} from "../../src/utils/notifications";
|
||||
import SettingsStore from "../../src/settings/SettingsStore";
|
||||
|
@ -47,38 +46,6 @@ describe('notifications', () => {
|
|||
mocked(SettingsStore).getValue.mockReturnValue(false);
|
||||
});
|
||||
|
||||
describe('createLocalNotification', () => {
|
||||
it('creates account data event', async () => {
|
||||
await createLocalNotificationSettingsIfNeeded(mockClient);
|
||||
const event = mockClient.getAccountData(accountDataEventKey);
|
||||
expect(event?.getContent().is_silenced).toBe(true);
|
||||
});
|
||||
|
||||
// Can't figure out why the mock does not override the value here
|
||||
/*.each(deviceNotificationSettingsKeys) instead of skip */
|
||||
it.skip("unsilenced for existing sessions", async (/*settingKey*/) => {
|
||||
mocked(SettingsStore)
|
||||
.getValue
|
||||
.mockImplementation((key) => {
|
||||
// return key === settingKey;
|
||||
});
|
||||
|
||||
await createLocalNotificationSettingsIfNeeded(mockClient);
|
||||
const event = mockClient.getAccountData(accountDataEventKey);
|
||||
expect(event?.getContent().is_silenced).toBe(false);
|
||||
});
|
||||
|
||||
it("does not override an existing account event data", async () => {
|
||||
mockClient.setAccountData(accountDataEventKey, {
|
||||
is_silenced: false,
|
||||
});
|
||||
|
||||
await createLocalNotificationSettingsIfNeeded(mockClient);
|
||||
const event = mockClient.getAccountData(accountDataEventKey);
|
||||
expect(event?.getContent().is_silenced).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('localNotificationsAreSilenced', () => {
|
||||
it('defaults to true when no setting exists', () => {
|
||||
expect(localNotificationsAreSilenced(mockClient)).toBeTruthy();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue