Files
healer-man/src/app/onlineGroupStore.test.ts
2026-08-20 14:05:50 -04:00

36 lines
1.2 KiB
TypeScript

import { beforeEach, describe, expect, it } from "vitest";
import { onlineGroupAiPartySize, useOnlineGroupStore } from "./onlineGroupStore";
describe("online group AI fill sizing", () => {
beforeEach(() => useOnlineGroupStore.getState().reset());
it("reserves one simulated slot for every grouped human other than the local player", () => {
useOnlineGroupStore.setState({
snapshot: {
invitations: [],
group: {
id: "group-test",
leaderAccountId: "one",
activity: null,
activityRevision: 0,
createdAt: 1,
updatedAt: 1,
members: [
{ accountId: "one", username: "One", character: null, role: null, joinedAt: 1 },
{ accountId: "two", username: "Two", character: null, role: null, joinedAt: 2 },
{ accountId: "three", username: "Three", character: null, role: null, joinedAt: 3 },
],
},
},
});
expect(onlineGroupAiPartySize(5)).toBe(3);
expect(onlineGroupAiPartySize(3)).toBe(1);
});
it("keeps ordinary solo activity sizes unchanged", () => {
expect(onlineGroupAiPartySize(5)).toBe(5);
expect(onlineGroupAiPartySize(1)).toBe(1);
});
});