-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.js
34 lines (27 loc) · 884 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { expect } from 'chai';
import snl from './src/index';
describe('strip-newlines', () => {
it('strips leading and trailing whitespace on a string', () => {
const string = snl` Hello World \t\n`;
expect(string).to.equal('Hello World');
});
it('replaces newlines and the whitespace that follows', () => {
const string = snl`Hello
World`;
expect(string).to.equal('Hello World');
});
it('substitutes tesnllate values into the string', () => {
const H = 'H';
const l = 'l';
const W = 'W';
const d = 'd';
const string = snl`${H}el${l}o
${W}orl${d}`;
expect(string).to.equal('Hello World');
});
it('strips out trailing whitespace before a new line', () => {
const string = snl`Hello
World`;
expect(string).to.equal('Hello World');
});
});