Conflict/packages/stat-sheet-block/src/stat-sheet-block.test.ts

54 lines
1.2 KiB
TypeScript

/**
* @jest-environment jsdom
*/
import Asciidoctor from "@asciidoctor/core";
import StatSheetBlock from "./stat-sheet-block";
const asciidoctor = Asciidoctor();
const registry = asciidoctor.Extensions.create();
StatSheetBlock.register(registry);
const asciidoc = `
[stat-sheet]
--
name = "Test Unit"
ac = 1
damage_threshold = 1
rating = 4
melee = 2
ranged = 2
attributes.strength = 2
attributes.dexterity = 1
attributes.intelligence = 0
attributes.wisdom = 0
traits = ["Trooper", "Marksman"]
[[actions]]
duration = 3
name = "My Name is Sean"
description = "Bah Gawd you instantly win the game."
[[abilities]]
name = "Favored Terrain"
description = "Do not take speed penalties when moving through Urbain terrain."
[[abilities]]
name = "Calm"
description = "This unit reduces their suppression condition by 1 at the end of their initiative."
[[abilities]]
name = "Sharpshooter"
description = "Automatically become Aiming 2 when taking the Aim action."
--
`;
test("it works", () => {
const el = document.createElement("div");
el.innerHTML = asciidoctor.convert(asciidoc, {
extension_registry: registry,
}) as string;
expect(el.querySelector(".stat-sheet .name")).toBeDefined();
});