Compare commits

..

No commits in common. "ff6a77d431919fda7fb0b4263cbcd00a9c36a514" and "4e2afd4db3173859aa3333f11b0125132fd7b28b" have entirely different histories.

4 changed files with 5 additions and 20 deletions

View file

@ -116,14 +116,14 @@ steps:
- name: test - name: test
image: node image: node
commands: commands:
- yarn test:unit --runInBand - yarn test:unit
depends_on: depends_on:
- dependencies - dependencies
- name: coverage - name: coverage
image: node image: node
commands: commands:
- yarn test:unit --coverage --runInBand - yarn test:unit --coverage
depends_on: depends_on:
- test # Must run after test otherwise SQLite will get mad - test # Must run after test otherwise SQLite will get mad

View file

@ -2,4 +2,3 @@ export * from "./MockDataConnection";
export * from "./MockPeer"; export * from "./MockPeer";
export * from "./MockHelper"; export * from "./MockHelper";
export * from "./EventHook"; export * from "./EventHook";
export * from "./IDBShim";

View file

@ -1,5 +1,5 @@
import { loadSets, getCards, Database, initDB, cardFullName } from "@/mlpccg"; import { loadSets, getCards, Database, initDB, cardFullName } from "@/mlpccg";
import { setupIDBShim } from "@/testing"; import { setupIDBShim } from "@/testing/IDBShim";
setupIDBShim(); setupIDBShim();

View file

@ -1,6 +1,6 @@
import { setupIDBShim } from "@/testing"; import { setupIDBShim } from "@/testing/IDBShim";
import { initDB, loadSets, Database } from "@/mlpccg"; import { initDB, loadSets, Database } from "@/mlpccg";
import { PackBuilder, spanByRarity, Cube } from "@/mlpccg/draft"; import { PackBuilder, spanByRarity } from "@/mlpccg/draft";
setupIDBShim(); setupIDBShim();
@ -22,18 +22,4 @@ describe("mlpccg/draft", () => {
expect(rarities["R"]).toHaveLength(1); expect(rarities["R"]).toHaveLength(1);
expect(rarities["U"]).toHaveLength(3); expect(rarities["U"]).toHaveLength(3);
}); });
test("Cube can load a newline separated card list", async () => {
expect(Database).toBeTruthy();
const cubeCards = ["ff10", "ff11", "ff12", "ff13", "ff14", "ff15"];
const cubeList = cubeCards.join("\n");
const cube = await Cube.fromList(cubeList);
const builder = new PackBuilder(cube.schema());
const pack = builder.buildPack();
// Pack size should only be 6, since there are not enough cards for a 12 cards pack
expect(pack).toHaveLength(6);
// Make sure pack has ALL the cards from the pool, no duplicates
const sortedPack = pack.map(c => c.ID).sort();
expect(sortedPack).toEqual(cubeCards);
});
}); });