Skip to content

Commit ade26f5

Browse files
committed
fix
1 parent 6301998 commit ade26f5

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/core/config/__tests__/ConfigManager.test.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -544,13 +544,12 @@ describe("ConfigManager", () => {
544544
apiConfigs: {},
545545
}
546546

547+
// Mock the readConfig and writeConfig methods
547548
mockSecrets.get.mockResolvedValue(JSON.stringify(emptyConfig))
549+
mockSecrets.store.mockResolvedValue(undefined)
548550

549-
// Create a new instance with the mock context
550-
const localConfigManager = new ConfigManager(mockContext)
551-
552-
// Call the migration method
553-
await localConfigManager.migrateRateLimitToProfiles()
551+
// Use the existing configManager instance
552+
await configManager.migrateRateLimitToProfiles()
554553

555554
// Verify the global rate limit was removed even with empty config
556555
expect(mockGlobalState.update).toHaveBeenCalledWith("rateLimitSeconds", undefined)
@@ -567,11 +566,8 @@ describe("ConfigManager", () => {
567566
// Force an error during read
568567
mockSecrets.get.mockRejectedValue(new Error("Storage failed"))
569568

570-
// Create a new instance with the mock context
571-
const localConfigManager = new ConfigManager(mockContext)
572-
573569
// Expect the migration to throw an error
574-
await expect(localConfigManager.migrateRateLimitToProfiles()).rejects.toThrow(
570+
await expect(configManager.migrateRateLimitToProfiles()).rejects.toThrow(
575571
"Failed to migrate rate limit settings: Error: Failed to read config from secrets: Error: Storage failed",
576572
)
577573
})

0 commit comments

Comments
 (0)