-
Notifications
You must be signed in to change notification settings - Fork 933
/
Copy pathbody-case.test.js
89 lines (75 loc) · 2.79 KB
/
body-case.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import test from 'ava';
import parse from '../library/parse';
import bodyCase from './body-case';
const messages = {
empty: 'test: subject',
lowercase: 'test: subject\nbody',
mixedcase: 'test: subject\nBody',
uppercase: 'test: subject\nBODY'
};
const parsed = {
empty: parse(messages.empty),
lowercase: parse(messages.lowercase),
mixedcase: parse(messages.mixedcase),
uppercase: parse(messages.uppercase)
};
test('with empty body should succeed for "never lowercase"', async t => {
const [actual] = bodyCase(await parsed.empty, 'never', 'lowercase');
const expected = true;
t.is(actual, expected);
});
test('with empty body should succeed for "always lowercase"', async t => {
const [actual] = bodyCase(await parsed.empty, 'always', 'lowercase');
const expected = true;
t.is(actual, expected);
});
test('with empty body should succeed for "never uppercase"', async t => {
const [actual] = bodyCase(await parsed.empty, 'never', 'uppercase');
const expected = true;
t.is(actual, expected);
});
test('with empty body should succeed for "always uppercase"', async t => {
const [actual] = bodyCase(await parsed.empty, 'always', 'uppercase');
const expected = true;
t.is(actual, expected);
});
test('with lowercase body should fail for "never lowercase"', async t => {
const [actual] = bodyCase(await parsed.lowercase, 'never', 'lowercase');
const expected = false;
t.is(actual, expected);
});
test('with lowercase body should succeed for "always lowercase"', async t => {
const [actual] = bodyCase(await parsed.lowercase, 'always', 'lowercase');
const expected = true;
t.is(actual, expected);
});
test('with mixedcase body should succeed for "never lowercase"', async t => {
const [actual] = bodyCase(await parsed.mixedcase, 'never', 'lowercase');
const expected = true;
t.is(actual, expected);
});
test('with mixedcase body should fail for "always lowercase"', async t => {
const [actual] = bodyCase(await parsed.mixedcase, 'always', 'lowercase');
const expected = false;
t.is(actual, expected);
});
test('with mixedcase body should succeed for "never uppercase"', async t => {
const [actual] = bodyCase(await parsed.mixedcase, 'never', 'uppercase');
const expected = true;
t.is(actual, expected);
});
test('with mixedcase body should fail for "always uppercase"', async t => {
const [actual] = bodyCase(await parsed.mixedcase, 'always', 'uppercase');
const expected = false;
t.is(actual, expected);
});
test('with uppercase body should fail for "never uppercase"', async t => {
const [actual] = bodyCase(await parsed.uppercase, 'never', 'uppercase');
const expected = false;
t.is(actual, expected);
});
test('with lowercase body should succeed for "always uppercase"', async t => {
const [actual] = bodyCase(await parsed.uppercase, 'always', 'uppercase');
const expected = true;
t.is(actual, expected);
});