Skip to content

Commit eae1ff4

Browse files
aarsilvclaude
andcommitted
Move getBanditsConfiguration tests inside main describe block
Fixes test isolation issue where tests ran after API server was closed. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 2b307b3 commit eae1ff4

1 file changed

Lines changed: 25 additions & 25 deletions

File tree

src/index.spec.ts

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -776,35 +776,35 @@ describe('EppoClient E2E test', () => {
776776
}
777777
});
778778
});
779-
});
780779

781-
describe('getBanditsConfiguration', () => {
782-
it('returns null when no bandits are configured', async () => {
783-
await init({
784-
apiKey: 'dummy',
785-
baseUrl: `http://127.0.0.1:${TEST_SERVER_PORT}`,
786-
assignmentLogger: { logAssignment: jest.fn() },
780+
describe('getBanditsConfiguration', () => {
781+
it('returns null when no bandits are configured', async () => {
782+
await init({
783+
apiKey: 'dummy',
784+
baseUrl: `http://127.0.0.1:${TEST_SERVER_PORT}`,
785+
assignmentLogger: { logAssignment: jest.fn() },
786+
});
787+
788+
// The default mock doesn't include bandits, so this should return null
789+
const banditsConfig = getBanditsConfiguration();
790+
expect(banditsConfig).toBeNull();
787791
});
788792

789-
// The default mock doesn't include bandits, so this should return null
790-
const banditsConfig = getBanditsConfiguration();
791-
expect(banditsConfig).toBeNull();
792-
});
793+
it('returns bandits configuration JSON when bandits are present', async () => {
794+
await init({
795+
apiKey: TEST_BANDIT_API_KEY,
796+
baseUrl: `http://127.0.0.1:${TEST_SERVER_PORT}`,
797+
assignmentLogger: { logAssignment: jest.fn() },
798+
banditLogger: { logBanditAction: jest.fn() },
799+
});
793800

794-
it('returns bandits configuration JSON when bandits are present', async () => {
795-
await init({
796-
apiKey: TEST_BANDIT_API_KEY,
797-
baseUrl: `http://127.0.0.1:${TEST_SERVER_PORT}`,
798-
assignmentLogger: { logAssignment: jest.fn() },
799-
banditLogger: { logBanditAction: jest.fn() },
801+
const banditsConfig = getBanditsConfiguration();
802+
// With the bandit API key, we should have bandits
803+
if (banditsConfig) {
804+
const parsed = JSON.parse(banditsConfig);
805+
expect(parsed.bandits).toBeDefined();
806+
expect(Object.keys(parsed.bandits).length).toBeGreaterThan(0);
807+
}
800808
});
801-
802-
const banditsConfig = getBanditsConfiguration();
803-
// With the bandit API key, we should have bandits
804-
if (banditsConfig) {
805-
const parsed = JSON.parse(banditsConfig);
806-
expect(parsed.bandits).toBeDefined();
807-
expect(Object.keys(parsed.bandits).length).toBeGreaterThan(0);
808-
}
809809
});
810810
});

0 commit comments

Comments
 (0)