[Upd] User states
This commit is contained in:
parent
d07202386f
commit
ec019a4dff
16 changed files with 667 additions and 87 deletions
19
packages/cache/src/sync.test.tsx
vendored
Normal file
19
packages/cache/src/sync.test.tsx
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { removeMissingContactSnapshots } from "./sync";
|
||||
|
||||
describe("authoritative contact cache updates", () => {
|
||||
it("removes missing users and keeps the latest authoritative set", () => {
|
||||
const contacts = [{ UserId: 2 }, { UserId: 3 }, { UserId: 4 }];
|
||||
expect(removeMissingContactSnapshots(contacts, [3, 99])).toEqual([
|
||||
{ UserId: 2 },
|
||||
{ UserId: 4 },
|
||||
]);
|
||||
});
|
||||
|
||||
it("does not let a delayed state notification recreate a removed contact", () => {
|
||||
const contacts = [{ UserId: 2 }];
|
||||
const afterMissing = removeMissingContactSnapshots(contacts, [2]);
|
||||
expect(removeMissingContactSnapshots(afterMissing, [])).toEqual([]);
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue