-
-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathtoBeSameLengthAs.spec.js
27 lines (27 loc) · 1.06 KB
/
toBeSameLengthAs.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('toBeSameLengthAs', () => {
describe('when invoked', () => {
describe('when the subject and comparison ARE both strings', () => {
describe('when the subject IS the same length as the comparision string', () => {
it('should confirm', () => {
expect('ab').toBeSameLengthAs('ab');
});
});
describe('when the subject is NOT the same length as the comparision string', () => {
it('should deny', () => {
expect('abc').not.toBeSameLengthAs('ab');
expect('a').not.toBeSameLengthAs('');
expect('').not.toBeSameLengthAs('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.toBeSameLengthAs(_undefined);
expect(_undefined).not.toBeSameLengthAs('truthy');
expect('').not.toBeSameLengthAs(_undefined);
expect(_undefined).not.toBeSameLengthAs('');
});
});
});
});