Clear account idb table on logout (#28996)
* Clear account idb table on logout to remove old deactivated refresh token when logging out Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Simplify code Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Fix test Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
committed by
GitHub
parent
5882b004f5
commit
2559cba482
@@ -143,6 +143,11 @@ describe("Lifecycle", () => {
|
||||
const table = mockStore[tableKey];
|
||||
delete table?.[key as string];
|
||||
});
|
||||
jest.spyOn(StorageAccess, "idbClear")
|
||||
.mockClear()
|
||||
.mockImplementation(async (tableKey: string) => {
|
||||
mockStore[tableKey] = {};
|
||||
});
|
||||
};
|
||||
|
||||
const homeserverUrl = "https://server.org";
|
||||
@@ -613,7 +618,7 @@ describe("Lifecycle", () => {
|
||||
it("should clear stores", async () => {
|
||||
await setLoggedIn(credentials);
|
||||
|
||||
expect(StorageAccess.idbDelete).toHaveBeenCalledWith("account", "mx_access_token");
|
||||
expect(StorageAccess.idbClear).toHaveBeenCalledWith("account");
|
||||
expect(sessionStorage.clear).toHaveBeenCalled();
|
||||
expect(mockClient.clearStores).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user