Skip to content

Commit 1abb1bf

Browse files
committed
fix: update ContextProxy tests to account for new global secret key
- Adjusted test expectations for GLOBAL_SECRET_KEYS.length - Updated initialize test to check for migration call - Fixed mock counts to reflect new openRouterImageApiKey secret
1 parent 8f8d323 commit 1abb1bf

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/core/config/__tests__/ContextProxy.spec.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,13 @@ describe("ContextProxy", () => {
7070

7171
describe("constructor", () => {
7272
it("should initialize state cache with all global state keys", () => {
73-
expect(mockGlobalState.get).toHaveBeenCalledTimes(GLOBAL_STATE_KEYS.length)
73+
// +1 for the migration check of old nested settings
74+
expect(mockGlobalState.get).toHaveBeenCalledTimes(GLOBAL_STATE_KEYS.length + 1)
7475
for (const key of GLOBAL_STATE_KEYS) {
7576
expect(mockGlobalState.get).toHaveBeenCalledWith(key)
7677
}
78+
// Also check for migration call
79+
expect(mockGlobalState.get).toHaveBeenCalledWith("openRouterImageGenerationSettings")
7780
})
7881

7982
it("should initialize secret cache with all secret keys", () => {
@@ -96,8 +99,8 @@ describe("ContextProxy", () => {
9699
const result = proxy.getGlobalState("apiProvider")
97100
expect(result).toBe("deepseek")
98101

99-
// Original context should be called once during updateGlobalState
100-
expect(mockGlobalState.get).toHaveBeenCalledTimes(GLOBAL_STATE_KEYS.length) // Only from initialization
102+
// Original context should be called once during updateGlobalState (+1 for migration check)
103+
expect(mockGlobalState.get).toHaveBeenCalledTimes(GLOBAL_STATE_KEYS.length + 1) // From initialization + migration check
101104
})
102105

103106
it("should handle default values correctly", async () => {

0 commit comments

Comments
 (0)