Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions client/src/components/ActionBar.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { act, create } from "react-test-renderer";
import { beforeEach, describe, expect, it, vi } from "vitest";

Check warning on line 2 in client/src/components/ActionBar.test.tsx

View workflow job for this annotation

GitHub Actions / client-lint

'expect' is defined but never used. Allowed unused vars must match /^_/u

const executeGameActionMock = vi.fn();
const notifyTargetClickedMock = vi.fn();
Expand Down Expand Up @@ -56,6 +56,15 @@
poisonConservativeExtraLivesTrigger: 0,
poisonConservativeAmount: 0,
poisonAggressiveAmount: 0,
poisonMinPower: 0,
poisonMinHealth: 0,
targetedPoisonPlayers: [],
targetedPoisonBeasts: [],
questMode: false,
questFilters: [],
maxBeastsPerAttack: 295,
skipSharedDiplomacy: false,
ignoredPlayers: [],
};

vi.mock("@/contexts/controller", () => ({
Expand Down Expand Up @@ -92,6 +101,20 @@
isBeastLocked: vi.fn(() => false),
}));

vi.mock("@/hooks/useAutopilotOrchestrator", () => ({
useAutopilotOrchestrator: () => ({
collectionWithCombat: [],
isSavage: false,
enableAttack: false,
revivalPotionsRequired: 0,
autopilotLog: "",
startAutopilot: vi.fn(),
stopAutopilot: vi.fn(),
handleApplyExtraLife: vi.fn(),
handleApplyPoison: vi.fn(),
}),
}));

vi.mock("./dialogs/AutopilotConfigModal", () => ({
default: () => null,
}));
Expand Down Expand Up @@ -123,13 +146,13 @@
mockGameStoreState.collection = [];
});

it("renders with missing balance keys without crashing", async () => {

Check failure on line 149 in client/src/components/ActionBar.test.tsx

View workflow job for this annotation

GitHub Actions / client-lint

Test has no assertions
await act(async () => {
create(<ActionBar />);
});
});

it("renders with populated balances without crashing", async () => {

Check failure on line 155 in client/src/components/ActionBar.test.tsx

View workflow job for this annotation

GitHub Actions / client-lint

Test has no assertions
mockControllerState.tokenBalances = {
REVIVE: 5,
ATTACK: 7,
Expand All @@ -142,7 +165,7 @@
});
});

it("handles invalid balance values without crashing", async () => {

Check failure on line 168 in client/src/components/ActionBar.test.tsx

View workflow job for this annotation

GitHub Actions / client-lint

Test has no assertions
mockControllerState.tokenBalances = {
REVIVE: Number.NaN,
ATTACK: Number.POSITIVE_INFINITY,
Expand Down
Loading
Loading