Skip to content

Commit 3f88511

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 0f6e3cb commit 3f88511

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
@@ -835,35 +835,35 @@ describe('EppoClient E2E test', () => {
835835
});
836836
});
837837
});
838-
});
839838

840-
describe('getBanditsConfiguration', () => {
841-
it('returns null when no bandits are configured', async () => {
842-
await init({
843-
apiKey: 'dummy',
844-
baseUrl: `http://127.0.0.1:${TEST_SERVER_PORT}`,
845-
assignmentLogger: { logAssignment: jest.fn() },
839+
describe('getBanditsConfiguration', () => {
840+
it('returns null when no bandits are configured', async () => {
841+
await init({
842+
apiKey: 'dummy',
843+
baseUrl: `http://127.0.0.1:${TEST_SERVER_PORT}`,
844+
assignmentLogger: { logAssignment: jest.fn() },
845+
});
846+
847+
// The default mock doesn't include bandits, so this should return null
848+
const banditsConfig = getBanditsConfiguration();
849+
expect(banditsConfig).toBeNull();
846850
});
847851

848-
// The default mock doesn't include bandits, so this should return null
849-
const banditsConfig = getBanditsConfiguration();
850-
expect(banditsConfig).toBeNull();
851-
});
852+
it('returns bandits configuration JSON when bandits are present', async () => {
853+
await init({
854+
apiKey: TEST_BANDIT_API_KEY,
855+
baseUrl: `http://127.0.0.1:${TEST_SERVER_PORT}`,
856+
assignmentLogger: { logAssignment: jest.fn() },
857+
banditLogger: { logBanditAction: jest.fn() },
858+
});
852859

853-
it('returns bandits configuration JSON when bandits are present', async () => {
854-
await init({
855-
apiKey: TEST_BANDIT_API_KEY,
856-
baseUrl: `http://127.0.0.1:${TEST_SERVER_PORT}`,
857-
assignmentLogger: { logAssignment: jest.fn() },
858-
banditLogger: { logBanditAction: jest.fn() },
860+
const banditsConfig = getBanditsConfiguration();
861+
// With the bandit API key, we should have bandits
862+
if (banditsConfig) {
863+
const parsed = JSON.parse(banditsConfig);
864+
expect(parsed.bandits).toBeDefined();
865+
expect(Object.keys(parsed.bandits).length).toBeGreaterThan(0);
866+
}
859867
});
860-
861-
const banditsConfig = getBanditsConfiguration();
862-
// With the bandit API key, we should have bandits
863-
if (banditsConfig) {
864-
const parsed = JSON.parse(banditsConfig);
865-
expect(parsed.bandits).toBeDefined();
866-
expect(Object.keys(parsed.bandits).length).toBeGreaterThan(0);
867-
}
868868
});
869869
});

0 commit comments

Comments
 (0)