-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
24 lines (19 loc) · 679 Bytes
/
test.js
File metadata and controls
24 lines (19 loc) · 679 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import test from 'ava';
import sentence from './index.js';
test('sentence return type to be string', t => {
t.is(typeof sentence(), 'string');
});
test('sentence without options contains 5 words', t => {
t.is(sentence().match(/(\w+)/g).length, 5);
});
test('sentence option words = 10 contains 10 words', t => {
t.is(sentence({words: 10}).match(/(\w+)/g).length, 10);
});
test('sentence is unique', t => {
const sentence1 = sentence({length: 12});
const sentence2 = sentence({length: 12});
t.false(sentence1 === sentence2);
});
test('sentence with options words = 10 contains 5', t => {
t.is(sentence({words: -1}).match(/(\w+)/g).length, 5);
});