@@ -47,6 +47,7 @@ describe("Matrix inbound event dedupe", () => {
|
47 | 47 | accessToken: "token", |
48 | 48 | deviceId: "DEVICE", |
49 | 49 | } as const; |
| 50 | +const persistenceTestTtlMs = 60_000; |
50 | 51 | |
51 | 52 | it("persists committed events across restarts", async () => { |
52 | 53 | const storagePath = createStoragePath(); |
@@ -123,7 +124,9 @@ describe("Matrix inbound event dedupe", () => {
|
123 | 124 | const first = await createMatrixInboundEventDeduper({ |
124 | 125 | auth: auth as never, |
125 | 126 | storagePath, |
126 | | -ttlMs: 20, |
| 127 | +// Plugin-state TTL uses real wall-clock time; keep restart/import tests |
| 128 | +// away from millisecond expiry races while fake nowMs drives dedupe pruning. |
| 129 | +ttlMs: persistenceTestTtlMs, |
127 | 130 | nowMs: () => now, |
128 | 131 | }); |
129 | 132 | |
@@ -138,7 +141,7 @@ describe("Matrix inbound event dedupe", () => {
|
138 | 141 | const second = await createMatrixInboundEventDeduper({ |
139 | 142 | auth: auth as never, |
140 | 143 | storagePath, |
141 | | -ttlMs: 20, |
| 144 | +ttlMs: persistenceTestTtlMs, |
142 | 145 | nowMs: () => now, |
143 | 146 | }); |
144 | 147 | expect(second.claimEvent({ roomId: "!room:example.org", eventId: "$backlog" })).toBe(false); |
@@ -158,7 +161,9 @@ describe("Matrix inbound event dedupe", () => {
|
158 | 161 | const first = await createMatrixInboundEventDeduper({ |
159 | 162 | auth: auth as never, |
160 | 163 | storagePath, |
161 | | -ttlMs: 20, |
| 164 | +// Plugin-state TTL uses real wall-clock time; this test proves migration |
| 165 | +// durability after the legacy JSON file is gone, not expiry behavior. |
| 166 | +ttlMs: persistenceTestTtlMs, |
162 | 167 | nowMs: () => 100, |
163 | 168 | }); |
164 | 169 | expect(first.claimEvent({ roomId: "!room:example.org", eventId: "$legacy" })).toBe(false); |
@@ -167,7 +172,7 @@ describe("Matrix inbound event dedupe", () => {
|
167 | 172 | const second = await createMatrixInboundEventDeduper({ |
168 | 173 | auth: auth as never, |
169 | 174 | storagePath, |
170 | | -ttlMs: 20, |
| 175 | +ttlMs: persistenceTestTtlMs, |
171 | 176 | nowMs: () => 100, |
172 | 177 | }); |
173 | 178 | expect(second.claimEvent({ roomId: "!room:example.org", eventId: "$legacy" })).toBe(false); |
|