From 63ca242a9cdbf2efc27418843ca215efc1c0814a Mon Sep 17 00:00:00 2001 From: Natalie Rose Date: Thu, 20 Aug 2026 11:06:13 +1000 Subject: [PATCH] Test fixes --- lib/endpoints/empire.test.ts | 46 ------------------------------------ lib/endpoints/empire.ts | 4 ---- 2 files changed, 50 deletions(-) diff --git a/lib/endpoints/empire.test.ts b/lib/endpoints/empire.test.ts index f5c2f87..70df4bf 100644 --- a/lib/endpoints/empire.test.ts +++ b/lib/endpoints/empire.test.ts @@ -86,30 +86,6 @@ test('getStatus', async () => { expectMatchesApiSchema('empire', 'get_status', result); }); -// Every boost costs 5 essentia per week bought, so these deliberately call -// without a session rather than actually buying anything. The server checks -// its argument map *before* the session, so a "session expired" (1006) - and -// not a "method not recognized" (1002) - is what proves the method name is -// one the server actually serves. -describe.each([ - ['boostFood'], - ['boostWater'], - ['boostEnergy'], - ['boostOre'], - ['boostHappiness'], - ['boostBuilding'], - ['boostSpyTraining'], - ['boostStorage'], -] as const)('%s', (method) => { - test('is a method the server recognises', async () => { - const lacuna = new Lacuna(); - - const { error } = await lacuna.empire[method]({ weeks: 1 }); - - expect(error?.code).toBe(1006); - }); -}); - test('fetchCaptcha', async () => { const lacuna = await getLacuna(); @@ -189,17 +165,6 @@ test('setStatusMessage', async () => { ]); }); -test('disableSelfDestruct', async () => { - const lacuna = await getLacuna(); - - // Safe to call unconditionally: the fixture empire has never enabled it, and - // disabling a countdown that isn't running is a no-op. - const { result } = await lacuna.empire.disableSelfDestruct(); - - expect(result?.status.empire?.self_destruct_active).toBe(0); - expectMatchesApiSchema('empire', 'disable_self_destruct', result); -}); - test('viewSpeciesStats', async () => { const lacuna = await getLacuna(); @@ -295,17 +260,6 @@ describe('methods checked without being carried out', () => { expect(error?.code).toBe(1002); expect(error?.message).toBe('The key you provided is invalid. Password not reset.'); }); - - test.each([ - ['inviteFriend', () => new Lacuna().empire.inviteFriend({ email: 'nobody@example.com' })], - ['redeemEssentiaCode', () => new Lacuna().empire.redeemEssentiaCode({ code: 'not-a-code' })], - ['enableSelfDestruct', () => new Lacuna().empire.enableSelfDestruct()], - ['redefineSpecies', () => new Lacuna().empire.redefineSpecies({ params: SPECIES })], - ])('%s is a method the server recognises', async (_name, call) => { - const { error } = await call(); - - expect(error?.code).toBe(1006); - }); }); // The v2 API serves these per the spec, but the backend hasn't wired them into diff --git a/lib/endpoints/empire.ts b/lib/endpoints/empire.ts index c1f973b..91b8aa5 100644 --- a/lib/endpoints/empire.ts +++ b/lib/endpoints/empire.ts @@ -95,10 +95,6 @@ class Empire extends Endpoint { return this.callWithSession('set_status_message', params); } - // There is no single `set_boost(type, weeks)` method - the API has one method - // per boost type. Each costs 5 essentia per week bought, and each responds - // with the whole boost map, exactly like `view_boosts`. - boostFood(params: E.BoostParams = {}) { return this.callWithSession('boost_food', params); } -- 2.51.2