From 73bbe87080fefd1427632acbce711997704976d0 Mon Sep 17 00:00:00 2001 From: bymyself Date: Mon, 26 Jan 2026 16:48:09 -0800 Subject: [PATCH] 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 --- .../remoteConfig/refreshRemoteConfig.test.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/platform/remoteConfig/refreshRemoteConfig.test.ts b/src/platform/remoteConfig/refreshRemoteConfig.test.ts index 3be44673d..f947b822c 100644 --- a/src/platform/remoteConfig/refreshRemoteConfig.test.ts +++ b/src/platform/remoteConfig/refreshRemoteConfig.test.ts @@ -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) + }) }) })