forked from github-tools/github-release-notes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_template.spec.js
More file actions
19 lines (17 loc) · 767 Bytes
/
_template.spec.js
File metadata and controls
19 lines (17 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { assert } from 'chai';
import { generate } from '../lib/src/_template';
describe('_template.js', () => {
describe('generate', () => {
it('Should return a string', () => {
const placeholders = {
greeting: 'ciao',
name: 'Alex'
};
const string = '{{greeting}}, {{name}}';
const functionString = ({ greeting, name }) => `${greeting} .. ${name.toLowerCase()}`;
assert.isString(generate(placeholders, string), 'Passing a string');
assert.deepEqual(generate(placeholders, string), 'ciao, Alex', 'Passing a string');
assert.deepEqual(generate(placeholders, functionString), 'ciao .. alex', 'Passing a function');
});
});
});