Skip to content

Commit f7b59ef

Browse files
committed
remove toXmlArrayMatch from Tex tests
1 parent 53a3126 commit f7b59ef

File tree

2 files changed

+62
-53
lines changed

2 files changed

+62
-53
lines changed

testsuite/tests/input/tex/Tex.test.ts

Lines changed: 10 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { beforeEach, describe, test, expect } from '@jest/globals';
22
import {
3-
toXmlArrayMatch,
43
toMathML,
54
tex2mml,
65
page2mml,
@@ -175,78 +174,36 @@ describe('FindTeX', () => {
175174
/********************************************************************************/
176175

177176
test('display math', async () => {
178-
toXmlArrayMatch(
179-
await page2mml('abc $$ x + 1 $$ def'),
180-
[
181-
`<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex=" x + 1 " display="block">
182-
<mi data-latex="x">x</mi>
183-
<mo data-latex="+">+</mo>
184-
<mn data-latex="1">1</mn>
185-
</math>`
186-
]
187-
);
177+
expect(
178+
await page2mml('abc $$ x + 1 $$ def')).toMatchSnapshot();
188179
});
189180

190181
/********************************************************************************/
191182

192183
test('environment', async () => {
193-
toXmlArrayMatch(
194-
await page2mml('abc \\begin{equation} x=y \\end{equation} def'),
195-
[
196-
`<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="\\begin{equation} x=y \\end{equation}" display="block">
197-
<mi data-latex="x">x</mi>
198-
<mo data-latex="=">=</mo>
199-
<mi data-latex="y">y</mi>
200-
</math>`
201-
]
202-
);
184+
expect(
185+
await page2mml('abc \\begin{equation} x=y \\end{equation} def')).toMatchSnapshot();
203186
});
204187

205188
/********************************************************************************/
206189

207190
test('Nested braces', async () => {
208-
toXmlArrayMatch(
209-
await page2mml('abc $$a + {\\bf b} + c$$ def'),
210-
[
211-
`<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="a + {\\bf b} + c" display="block">
212-
<mi data-latex="a">a</mi>
213-
<mo data-latex="+">+</mo>
214-
<mrow data-mjx-texclass="ORD" data-latex="{b}">
215-
<mi mathvariant="bold" data-latex="b">b</mi>
216-
</mrow>
217-
<mo data-latex="+">+</mo>
218-
<mi data-latex="c">c</mi>
219-
</math>`
220-
]
221-
);
191+
expect(
192+
await page2mml('abc $$a + {\\bf b} + c$$ def')).toMatchSnapshot();
222193
});
223194

224195
/********************************************************************************/
225196

226197
test('processEscapes', async () => {
227-
toXmlArrayMatch(
228-
await page2mml('abc \\$ def'),
229-
[
230-
`<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="$">
231-
<mo data-latex="$">$</mo>
232-
</math>`
233-
]
234-
);
198+
expect(
199+
await page2mml('abc \\$ def')).toMatchSnapshot();
235200
});
236201

237202
/********************************************************************************/
238203

239204
test('ref undefined', async () => {
240-
toXmlArrayMatch(
241-
await page2mml('abc \\ref{x} def'),
242-
[
243-
`<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="\\ref{x}">
244-
<mrow href="#" class="MathJax_ref" data-latex="\\ref{x}">
245-
<mtext>???</mtext>
246-
</mrow>
247-
</math>`
248-
]
249-
);
205+
expect(
206+
await page2mml('abc \\ref{x} def')).toMatchSnapshot();
250207
});
251208

252209
/********************************************************************************/

testsuite/tests/input/tex/__snapshots__/Tex.test.ts.snap

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,57 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3+
exports[`FindTeX Nested braces 1`] = `
4+
[
5+
"<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="a + {\\bf b} + c" display="block">
6+
<mi data-latex="a">a</mi>
7+
<mo data-latex="+">+</mo>
8+
<mrow data-mjx-texclass="ORD" data-latex="{b}">
9+
<mi mathvariant="bold" data-latex="b">b</mi>
10+
</mrow>
11+
<mo data-latex="+">+</mo>
12+
<mi data-latex="c">c</mi>
13+
</math>",
14+
]
15+
`;
16+
17+
exports[`FindTeX display math 1`] = `
18+
[
19+
"<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex=" x + 1 " display="block">
20+
<mi data-latex="x">x</mi>
21+
<mo data-latex="+">+</mo>
22+
<mn data-latex="1">1</mn>
23+
</math>",
24+
]
25+
`;
26+
27+
exports[`FindTeX environment 1`] = `
28+
[
29+
"<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="\\begin{equation} x=y \\end{equation}" display="block">
30+
<mi data-latex="x">x</mi>
31+
<mo data-latex="=">=</mo>
32+
<mi data-latex="y">y</mi>
33+
</math>",
34+
]
35+
`;
36+
37+
exports[`FindTeX processEscapes 1`] = `
38+
[
39+
"<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="$">
40+
<mo data-latex="$">$</mo>
41+
</math>",
42+
]
43+
`;
44+
45+
exports[`FindTeX ref undefined 1`] = `
46+
[
47+
"<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="\\ref{x}">
48+
<mrow href="#" class="MathJax_ref" data-latex="\\ref{x}">
49+
<mtext>???</mtext>
50+
</mrow>
51+
</math>",
52+
]
53+
`;
54+
355
exports[`NodeFactory create null kind 1`] = `"<mi></mi>"`;
456

557
exports[`Stack getTop 1`] = `

0 commit comments

Comments
 (0)