Files
smartntml/test/test.node.ts
T

29 lines
840 B
TypeScript
Raw Normal View History

import { tap } from '@git.zone/tstest/tapbundle';
import { GlobalRegistrator } from '@happy-dom/global-registrator';
2022-05-28 17:29:36 +02:00
import * as smartntml from '../ts/index.js';
let testSmartntmlInstance: smartntml.Smartntml;
tap.registerCleanup(async () => {
if (GlobalRegistrator.isRegistered) {
await GlobalRegistrator.unregister();
}
await tap.stopForcefully(0);
});
2022-05-28 17:29:36 +02:00
tap.test('first test', async () => {
testSmartntmlInstance = new smartntml.Smartntml();
2022-05-28 17:29:36 +02:00
});
tap.test('should render a string', async () => {
const arrayArg = [1, 2, 3, 4, 5, 6];
const stringResult = await testSmartntmlInstance.renderTemplateResult(smartntml.deesElement.html`
2022-05-28 17:29:36 +02:00
<div class="hello">${arrayArg.map(
(element) => smartntml.deesElement.html`<div>${element}</div>`
2022-05-28 17:29:36 +02:00
)}</div>
`);
console.log(stringResult);
});
export default tap.start();