feat: show call participants in room list (Discord-style)
Docker / Docker Buildx (push) Has been cancelled
Build Debian package / Build package (release) Has been cancelled
Build and Deploy / prepare (release) Has been cancelled
Deploy release / Deploy to Cloudflare Pages (release) Has been cancelled
Build and Deploy / Trigger Pro pipeline (release) Has been cancelled
Build and Deploy / Windows arm64 (release) Has been cancelled
Build and Deploy / Windows x64 (release) Has been cancelled
Build and Deploy / macOS (release) Has been cancelled
Build and Deploy / Linux amd64 (sqlcipher static) (release) Has been cancelled
Build and Deploy / Linux arm64 (sqlcipher static) (release) Has been cancelled
Build and Deploy / ${{ needs.prepare.outputs.deploy == 'true' && 'Deploy' || 'Deploy (dry-run)' }} (release) Has been cancelled
Build and Deploy / Deploy builds to ESS (release) Has been cancelled
Docker / Docker Buildx (push) Has been cancelled
Build Debian package / Build package (release) Has been cancelled
Build and Deploy / prepare (release) Has been cancelled
Deploy release / Deploy to Cloudflare Pages (release) Has been cancelled
Build and Deploy / Trigger Pro pipeline (release) Has been cancelled
Build and Deploy / Windows arm64 (release) Has been cancelled
Build and Deploy / Windows x64 (release) Has been cancelled
Build and Deploy / macOS (release) Has been cancelled
Build and Deploy / Linux amd64 (sqlcipher static) (release) Has been cancelled
Build and Deploy / Linux arm64 (sqlcipher static) (release) Has been cancelled
Build and Deploy / ${{ needs.prepare.outputs.deploy == 'true' && 'Deploy' || 'Deploy (dry-run)' }} (release) Has been cancelled
Build and Deploy / Deploy builds to ESS (release) Has been cancelled
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
Copyright 2024 New Vector Ltd.
|
||||
Copyright 2024 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import "fake-indexeddb/auto";
|
||||
|
||||
import { idbDelete, idbLoad, idbSave } from "../../../src/utils/StorageAccess";
|
||||
|
||||
const NONEXISTENT_TABLE = "this_is_not_a_table_we_use_ever_and_so_we_can_use_it_in_tests";
|
||||
const KNOWN_TABLES = ["account", "pickleKey"];
|
||||
|
||||
describe("StorageAccess", () => {
|
||||
it.each(KNOWN_TABLES)("should save, load, and delete from known table '%s'", async (tableName: string) => {
|
||||
const key = ["a", "b"];
|
||||
const data = { hello: "world" };
|
||||
|
||||
// Should start undefined
|
||||
let loaded = await idbLoad(tableName, key);
|
||||
expect(loaded).toBeUndefined();
|
||||
|
||||
// ... then define a value
|
||||
await idbSave(tableName, key, data);
|
||||
|
||||
// ... then check that value
|
||||
loaded = await idbLoad(tableName, key);
|
||||
expect(loaded).toEqual(data);
|
||||
|
||||
// ... then set it back to undefined
|
||||
await idbDelete(tableName, key);
|
||||
|
||||
// ... which we then check again
|
||||
loaded = await idbLoad(tableName, key);
|
||||
expect(loaded).toBeUndefined();
|
||||
});
|
||||
|
||||
it("should fail to save, load, and delete from a non-existent table", async () => {
|
||||
// Regardless of validity on the key/data, or write order, these should all fail.
|
||||
await expect(() => idbSave(NONEXISTENT_TABLE, "whatever", "value")).rejects.toThrow();
|
||||
await expect(() => idbLoad(NONEXISTENT_TABLE, "whatever")).rejects.toThrow();
|
||||
await expect(() => idbDelete(NONEXISTENT_TABLE, "whatever")).rejects.toThrow();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user