Clear settings store cache on logout (#12786)

And clear it in the widget layout store test, also fixing the tests
which didn't actually individually as they actually relied on the state
bleeding between tests.
This commit is contained in:
David Baker 2024-07-17 10:58:07 +01:00 committed by GitHub
parent cf96a6d82c
commit c57d8463b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 31 additions and 13 deletions

View file

@ -57,6 +57,8 @@ describe("WidgetLayoutStore", () => {
off: jest.fn(),
getApps: () => mockApps,
} as unknown as WidgetStore);
SettingsStore.reset();
});
beforeAll(() => {
@ -156,9 +158,14 @@ describe("WidgetLayoutStore", () => {
await store.start();
expect(roomUpdateListener).toHaveBeenCalled();
expect(store.getContainerWidgets(mockRoom, Container.Top)).toEqual([mockApps[0]]);
expect(store.getContainerWidgets(mockRoom, Container.Top)).toEqual([]);
expect(store.getContainerWidgets(mockRoom, Container.Center)).toEqual([]);
expect(store.getContainerWidgets(mockRoom, Container.Right)).toEqual([mockApps[1], mockApps[2], mockApps[3]]);
expect(store.getContainerWidgets(mockRoom, Container.Right)).toEqual([
mockApps[0],
mockApps[1],
mockApps[2],
mockApps[3],
]);
});
it("should clear the layout and emit an update if there are no longer apps in the room", () => {
@ -238,21 +245,15 @@ describe("WidgetLayoutStore", () => {
"widgets": {
"1": {
"container": "top",
"height": 23,
"index": 2,
"width": 64,
"height": undefined,
"index": 0,
"width": 100,
},
"2": {
"container": "top",
"height": 23,
"index": 0,
"width": 10,
"container": "right",
},
"3": {
"container": "top",
"height": 23,
"index": 1,
"width": 26,
"container": "right",
},
"4": {
"container": "right",