test: tighten device auth store assertions · openclaw/openclaw@295563e
shakkernerd
·
2026-05-11
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -40,7 +40,12 @@ describe("device-auth-store", () => {
|
40 | 40 | deviceId: "device-1", |
41 | 41 | role: " operator ", |
42 | 42 | }), |
43 | | -).toMatchObject({ token: "secret" }); |
| 43 | +).toEqual({ |
| 44 | +token: "secret", |
| 45 | +role: "operator", |
| 46 | +scopes: ["operator.read"], |
| 47 | +updatedAtMs: 1, |
| 48 | +}); |
44 | 49 | expect( |
45 | 50 | loadDeviceAuthTokenFromStore({ |
46 | 51 | adapter, |
@@ -126,6 +131,7 @@ describe("device-auth-store", () => {
|
126 | 131 | }); |
127 | 132 | |
128 | 133 | it("replaces stale stores from other devices instead of merging them", () => { |
| 134 | +vi.spyOn(Date, "now").mockReturnValue(3456); |
129 | 135 | const { adapter, readStore } = createAdapter({ |
130 | 136 | version: 1, |
131 | 137 | deviceId: "device-2", |
@@ -154,7 +160,7 @@ describe("device-auth-store", () => {
|
154 | 160 | token: "node-token", |
155 | 161 | role: "node", |
156 | 162 | scopes: [], |
157 | | -updatedAtMs: expect.any(Number), |
| 163 | +updatedAtMs: 3456, |
158 | 164 | }, |
159 | 165 | }, |
160 | 166 | }); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。