Files
smartmustache/test/test.ts

21 lines
630 B
TypeScript
Raw Normal View History

2018-09-14 21:02:17 +00:00
import { tap, expect } from '@pushrocks/tapbundle';
2016-11-20 17:41:26 +01:00
2022-08-07 16:45:38 +02:00
import * as tlt from '../ts/index.js';
2016-11-20 17:41:26 +01:00
2018-09-15 12:43:01 +02:00
let testMustache: tlt.SmartMustache;
2018-09-14 21:02:17 +00:00
tap.test('should create a valid instance of tlt', async () => {
2019-02-17 17:04:31 +01:00
testMustache = new tlt.SmartMustache(
'some awesome {{customString}} that is {{license}} licensed'
);
2022-08-07 16:45:38 +02:00
expect(testMustache).toBeInstanceOf(tlt.SmartMustache);
2018-09-14 21:02:17 +00:00
});
tap.test('should output a valid string with some data', async () => {
2018-09-15 12:43:01 +02:00
let appliedString = testMustache.applyData({
2018-09-14 21:02:17 +00:00
customString: 'horse',
2021-03-27 15:07:02 +00:00
license: 'MIT',
2018-09-14 21:02:17 +00:00
});
2022-08-07 16:45:38 +02:00
expect(appliedString).toEqual('some awesome horse that is MIT licensed');
2018-09-14 21:02:17 +00:00
});
tap.start();