From 667fa2d8f28da97a4a56045fbdb406c26c4d2ba4 Mon Sep 17 00:00:00 2001 From: oozcitak Date: Thu, 29 Jul 2021 14:32:39 +0300 Subject: [PATCH] Add import test to callback API --- test/callback/basic.test.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/callback/basic.test.ts b/test/callback/basic.test.ts index 6f11a7d..c7d5c93 100644 --- a/test/callback/basic.test.ts +++ b/test/callback/basic.test.ts @@ -102,6 +102,20 @@ describe('basic callback API tests', () => { $$.expectCBResult(xmlStream, ``, done) }) + test('import', (done) => { + const frag1 = $$.fragment().ele("node1") + const frag2 = $$.fragment().ele("node2") + + const xmlStream = $$.createCB() + + xmlStream.ele("root") + .import(frag1) + .import(frag2) + .end() + + $$.expectCBResult(xmlStream, ``, done) + }) + test('nodes at root level', (done) => { const xmlStream = $$.createCB({ prettyPrint: true }) @@ -164,4 +178,16 @@ describe('basic callback API tests', () => { '', done) }) + test('empty ele should throw', (done) => { + const xmlStream = $$.createCB() + + $$.expectCBError(xmlStream, () => xmlStream.ele(undefined as any), done) + }) + + test('empty import should throw', (done) => { + const xmlStream = $$.createCB() + + $$.expectCBError(xmlStream, () => xmlStream.import(undefined as any), done) + }) + })