-
-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathtoBeLongerThan.spec.js
27 lines (27 loc) · 1.02 KB
/
toBeLongerThan.spec.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
describe('toBeLongerThan', () => {
describe('when invoked', () => {
describe('when the subject and comparison ARE both strings', () => {
describe('when the subject IS longer than the comparision string', () => {
it('should confirm', () => {
expect('abc').toBeLongerThan('ab');
expect('a').toBeLongerThan('');
});
});
describe('when the subject is NOT longer than the comparision string', () => {
it('should deny', () => {
expect('ab').not.toBeLongerThan('abc');
expect('').not.toBeLongerThan('a');
});
});
});
describe('when the subject and comparison are NOT both strings', () => {
it('should deny (we are asserting the relative lengths of two strings)', () => {
let _undefined;
expect('truthy').not.toBeLongerThan(_undefined);
expect(_undefined).not.toBeLongerThan('truthy');
expect('').not.toBeLongerThan(_undefined);
expect(_undefined).not.toBeLongerThan('');
});
});
});
});