|
1 | 1 | import { beforeEach, describe, test, expect } from '@jest/globals'; |
2 | 2 | import { |
3 | | - toXmlArrayMatch, |
4 | 3 | toMathML, |
5 | 4 | tex2mml, |
6 | 5 | page2mml, |
@@ -175,78 +174,36 @@ describe('FindTeX', () => { |
175 | 174 | /********************************************************************************/ |
176 | 175 |
|
177 | 176 | 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(); |
188 | 179 | }); |
189 | 180 |
|
190 | 181 | /********************************************************************************/ |
191 | 182 |
|
192 | 183 | 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(); |
203 | 186 | }); |
204 | 187 |
|
205 | 188 | /********************************************************************************/ |
206 | 189 |
|
207 | 190 | 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(); |
222 | 193 | }); |
223 | 194 |
|
224 | 195 | /********************************************************************************/ |
225 | 196 |
|
226 | 197 | 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(); |
235 | 200 | }); |
236 | 201 |
|
237 | 202 | /********************************************************************************/ |
238 | 203 |
|
239 | 204 | 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(); |
250 | 207 | }); |
251 | 208 |
|
252 | 209 | /********************************************************************************/ |
|
0 commit comments