feat(team-calc) : add character-wide team import
This commit is contained in:
@@ -26,10 +26,10 @@ vi.mock("@/db", () => ({
|
||||
|
||||
import {
|
||||
artifactConditions, artifactProfiles, constellationConditions, extraSectionRows,
|
||||
guides, guideSections, teamConditions, weaponConditions,
|
||||
guides, guideSections, teamCompositions, teamConditions, teamMembers, weaponConditions,
|
||||
catalogMaterials, guidePosterBleeding, media,
|
||||
} from "@/db/schema";
|
||||
import { getAdminGuideContent } from "./queries";
|
||||
import { getAdminGuideContent, listAdminTeamImportsForCharacter } from "./queries";
|
||||
|
||||
beforeEach(() => {
|
||||
mocks.reads.length = 0;
|
||||
@@ -102,3 +102,32 @@ describe("admin section reads", () => {
|
||||
expect(mocks.reads.filter((table) => table === media)).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("team import lookup", () => {
|
||||
it("hydrates matching teams and source labels with one member read", async () => {
|
||||
mocks.rows.set(teamCompositions, [{
|
||||
id: "team-1", title: "Example", rotationSeconds: "20", combo: "E > Q",
|
||||
guideName: "Other Guide", conditionName: "Boss",
|
||||
}]);
|
||||
mocks.rows.set(teamMembers, [{
|
||||
member: {
|
||||
teamId: "team-1", characterKey: "character-1", weaponKey: "weapon-1",
|
||||
artifactKey: "artifact-1", secondArtifactKey: null,
|
||||
constellation: "2", refinement: "1", damage: "100",
|
||||
},
|
||||
characterName: "Character One",
|
||||
}]);
|
||||
|
||||
const result = await listAdminTeamImportsForCharacter("current-guide", "character-1");
|
||||
expect(result).toEqual([{
|
||||
id: "team-1", title: "Example", rotationSeconds: "20", combo: "E > Q",
|
||||
guideName: "Other Guide", conditionName: "Boss",
|
||||
members: [{
|
||||
characterKey: "character-1", characterName: "Character One", weaponKey: "weapon-1",
|
||||
artifactKey: "artifact-1", secondArtifactKey: null,
|
||||
constellation: "2", refinement: "1", damage: "100",
|
||||
}],
|
||||
}]);
|
||||
expect(mocks.reads).toEqual([teamCompositions, teamMembers]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user