import { testLawtextToStd } from "../testHelper"; import $arithFormula, { arithFormulaToLines } from "./$arithFormula"; describe("Test $arithFormula and arithFormulaToLines", () => { it("Success case", () => { /* eslint-disable no-irregular-whitespace */ const lawtextWithMarker = `\ :arith-formula: Pc′/Pc×0.8+Pi′/Pi×0.2 # 別表第二 外国旅行の旅費(第三十五条―第三十七条、第三十九条、第四十条、第四十一条関係) `; const expectedErrorMessages: string[] = []; const expectedRendered = `\ :arith-formula: Pc′/Pc×0.8+Pi′/Pi×0.2 `.replace(/\r?\n/g, "\r\n"); const expectedValue = { tag: "ArithFormula", attr: {}, children: [ { tag: "Sentence", attr: {}, children: ["Pc′/Pc×0.8+Pi′/Pi×0.2"], }, ], }; testLawtextToStd( lawtextWithMarker, expectedRendered, expectedValue, expectedErrorMessages, (vlines, env) => $arithFormula.match(0, vlines, env), el => arithFormulaToLines(el, []), ); }); it("Success case", () => { /* eslint-disable no-irregular-whitespace */ const lawtextWithMarker = `\ :arith-formula: # 別表第二 外国旅行の旅費(第三十五条―第三十七条、第三十九条、第四十条、第四十一条関係) `; const expectedErrorMessages: string[] = []; const expectedRendered = `\ :arith-formula: `.replace(/\r?\n/g, "\r\n"); const expectedValue = { tag: "ArithFormula", attr: {}, children: [], }; testLawtextToStd( lawtextWithMarker, expectedRendered, expectedValue, expectedErrorMessages, (vlines, env) => $arithFormula.match(0, vlines, env), el => arithFormulaToLines(el, []), ); }); });