test: add munderover error test case

This commit is contained in:
Alexandre Nunes 2020-10-02 09:59:41 -03:00
parent 0ebed58ba0
commit 9d1f01d37c
2 changed files with 24 additions and 0 deletions

@ -1,5 +1,6 @@
import MathMLToLaTeX from '../src';
import * as mathmlStrings from './mocks/mathmlStrings';
import { InvalidNumberOfChild } from '../src/data/errors/InvalidNumberOfChild';
describe('#convert', () => {
describe('given math string with mi tag', () => {
@ -883,6 +884,16 @@ describe('#convert', () => {
expect(result).toBe('\\int_{0}^{\\infty}');
});
});
describe('with munderover with 4 children', () => {
it('should throws InvalidNumberOfChildErrors', () => {
const mathml = mathmlStrings.munderoverWithThreeChildren;
const result = () => MathMLToLaTeX.convert(mathml);
expect(result).toThrow(new InvalidNumberOfChild('munderover', 3, 4));
});
});
});
describe('given math string with mmultiscript', () => {

@ -1472,6 +1472,19 @@ export const munderoverEncoded = `
</root>
`;
export const munderoverWithThreeChildren = `
<root>
<math>
<munderover>
<mo> &#x222B;</mo>
<mn> 0 </mn>
<mi> &#x221E; </mi>
<mi> 1 </mi>
</munderover>
</math>
</root>
`;
export const mmultiscript = `<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mmultiscripts>
<mrow>