smartntml/test/test.ts

27 lines
754 B
TypeScript
Raw Normal View History

2023-03-30 09:02:15 +00:00
import log from 'why-is-node-running';
2022-05-28 15:29:36 +00:00
import { expect, expectAsync, tap } from '@pushrocks/tapbundle';
import * as smartntml from '../ts/index.js';
let testSmartntmlInstance: smartntml.Smartntml;
tap.test('first test', async () => {
2023-03-30 09:02:15 +00:00
testSmartntmlInstance = await smartntml.Smartntml.create();
2022-05-28 15:29:36 +00:00
});
tap.test('should render a string', async () => {
const arrayArg = [1, 2, 3, 4, 5, 6];
const stringResult = await testSmartntmlInstance.renderTemplateResult(testSmartntmlInstance.html`
<div class="hello">${arrayArg.map(
(element) => testSmartntmlInstance.html`<div>${element}</div>`
)}</div>
`);
console.log(stringResult);
});
2023-03-30 09:02:15 +00:00
tap.test('should log', async () => {
log();
setTimeout(()=> process.exit(0), 0);
})
2022-05-28 15:29:36 +00:00
tap.start();