test: add test for 500 response preserving config

Verify that non-auth server errors (like 500) do not clear the existing config, documenting the expected behavior that config is only cleared on 401/403 responses
This commit is contained in:
bymyself
2026-01-26 16:48:09 -08:00
parent 4cb555ab18
commit 73bbe87080

View File

@@ -107,5 +107,20 @@ describe('refreshRemoteConfig', () => {
expect(remoteConfig.value).toEqual({})
expect(window.__CONFIG__).toEqual({})
})
it('preserves config on 500 response', async () => {
const existingConfig = { subscription_required: true }
remoteConfig.value = existingConfig
window.__CONFIG__ = existingConfig
vi.mocked(api.fetchApi).mockResolvedValue(
mockErrorResponse(500, 'Internal Server Error')
)
await refreshRemoteConfig()
expect(remoteConfig.value).toEqual(existingConfig)
expect(window.__CONFIG__).toEqual(existingConfig)
})
})
})