From 083e564e2d5989815de178579cd2c04f2d8cca0e Mon Sep 17 00:00:00 2001 From: Alexandre Nunes Date: Sat, 3 Oct 2020 11:19:07 -0300 Subject: [PATCH] test: add msubsup InvalidNumberOfChildrenError --- __test__/index.test.ts | 10 ++++++++++ __test__/mocks/mathmlStrings.ts | 13 +++++++++++++ 2 files changed, 23 insertions(+) diff --git a/__test__/index.test.ts b/__test__/index.test.ts index 0890ff0..884d35a 100755 --- a/__test__/index.test.ts +++ b/__test__/index.test.ts @@ -762,6 +762,16 @@ describe('#convert', () => { expect(result).toBe('\\left(x + y\\right)_{0}^{1}'); }); + + describe('when it have four children', () => { + it('throws InvalidNumberOfChildrenError', () => { + const mathml = mathmlStrings.msubsupWithFourChildren; + + const result = () => MathMLToLaTeX.convert(mathml); + + expect(result).toThrow(new InvalidNumberOfChildrenError('msubsup', 3, 4)); + }); + }); }); describe('given math string with mtext', () => { diff --git a/__test__/mocks/mathmlStrings.ts b/__test__/mocks/mathmlStrings.ts index 0b9bae6..31ee1f2 100755 --- a/__test__/mocks/mathmlStrings.ts +++ b/__test__/mocks/mathmlStrings.ts @@ -1301,6 +1301,19 @@ export const msubsupWithMrow = ` `; +export const msubsupWithFourChildren = ` + + + + + 0 + 1 + 5 + + + +`; + export const mtext = `