smartntml/test/test.ts

27 lines
748 B
TypeScript
Raw Normal View History

2023-03-30 09:02:15 +00:00
import log from 'why-is-node-running';
2024-05-27 22:28:33 +00:00
import { expect, expectAsync, tap } from '@push.rocks/tapbundle';
2022-05-28 15:29:36 +00:00
import * as smartntml from '../ts/index.js';
let testSmartntmlInstance: smartntml.Smartntml;
tap.test('first test', async () => {
testSmartntmlInstance = new smartntml.Smartntml();
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(smartntml.deesElement.html`
2022-05-28 15:29:36 +00:00
<div class="hello">${arrayArg.map(
(element) => smartntml.deesElement.html`<div>${element}</div>`
2022-05-28 15:29:36 +00:00
)}</div>
`);
console.log(stringResult);
});
2023-03-30 09:02:15 +00:00
tap.test('should log', async () => {
log();
2023-05-01 11:03:55 +00:00
setTimeout(() => process.exit(0), 0);
});
2023-03-30 09:02:15 +00:00
2022-05-28 15:29:36 +00:00
tap.start();