smartmustache/test/test.ts

21 lines
630 B
TypeScript
Raw Permalink Normal View History

2018-09-14 21:02:17 +00:00
import { tap, expect } from '@pushrocks/tapbundle';
2016-11-20 16:41:26 +00:00
2022-08-07 14:45:38 +00:00
import * as tlt from '../ts/index.js';
2016-11-20 16:41:26 +00:00
2018-09-15 10:43:01 +00: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 16:04:31 +00:00
testMustache = new tlt.SmartMustache(
'some awesome {{customString}} that is {{license}} licensed'
);
2022-08-07 14:45:38 +00: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 10:43:01 +00: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 14:45:38 +00:00
expect(appliedString).toEqual('some awesome horse that is MIT licensed');
2018-09-14 21:02:17 +00:00
});
tap.start();