mlpcardgame/src/tests/unit/cards.spec.ts

17 lines
683 B
TypeScript

import { Card, createPonyheadURL, cardFullName } from "@/mlpccg";
describe("mlpccg/cards", () => {
test("Card full names are correctly generated in all cases", () => {
const card1 = { Name: "Name", Subname: "" };
const card2 = { Name: "Name1", Subname: "the Name2" };
expect(cardFullName(card1 as Card)).toEqual("Name");
expect(cardFullName(card2 as Card)).toEqual("Name1, the Name2");
});
test("Ponyhead URL is generated correctly", () => {
const cards: any[] = [{ ID: "pr10" }, { ID: "pr12" }, { ID: "pr13" }];
const url = "https://ponyhead.com/deckbuilder?v1code=pr10x1-pr12x1-pr13x1";
expect(createPonyheadURL(cards!)).toEqual(url);
});
});