From 65e1d0985cbbd8fccd80dfeb5d2c87d30eded6cd Mon Sep 17 00:00:00 2001 From: Alexandre Nunes Date: Sat, 19 Sep 2020 14:14:03 -0300 Subject: [PATCH] test: add especial symbols to mi tag implementation --- __test__/index.test.ts | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/__test__/index.test.ts b/__test__/index.test.ts index 6e483b9..6eba3f5 100755 --- a/__test__/index.test.ts +++ b/__test__/index.test.ts @@ -21,13 +21,35 @@ describe('#convert', () => { }); }); - describe('given math string with mi tag with space on it', () => { - test('should trim empty space', () => { - const mathml = ' a '; + describe('given math string with mi tag', () => { + describe('tag with space on it', () => { + test('should trim empty space', () => { + const mathml = ' a '; - const result = MathMLToLaTeX.convert(mathml); + const result = MathMLToLaTeX.convert(mathml); - expect(result).toBe('a'); + expect(result).toBe('a'); + }); + }); + + describe('with especial operator', () => { + test('should convert to latex command', () => { + const mathml = ''; + + const result = MathMLToLaTeX.convert(mathml); + + expect(result).toBe('\\infty'); + }); + }); + + describe('with empty space', () => { + test('should keep empty space and convert to mathrm command', () => { + const mathml = ' '; + + const result = MathMLToLaTeX.convert(mathml); + + expect(result).toBe('\\textrm{ }'); + }); }); });