-
Notifications
You must be signed in to change notification settings - Fork 4
/
StrictEqualTo.spec.ts
49 lines (37 loc) · 1.27 KB
/
StrictEqualTo.spec.ts
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
import { sameTypeAs, strictEqualTo, StrictEqualTo } from "..";
describe( 'StrictEqualTo', () => {
describe( 'satisfied by', () => {
it( 'same value, both integer numbers', () => {
expect(
( new StrictEqualTo( 0 ) ).isSatisfiedBy( 0 )
).toBeTruthy();
} );
it( 'same value, integer and double', () => {
expect(
( new StrictEqualTo( 0 ) ).isSatisfiedBy( 0.0 )
).toBeTruthy();
} );
it( 'same value, both double numbers', () => {
expect(
( new StrictEqualTo( 0.0 ) ).isSatisfiedBy( 0.0 )
).toBeTruthy();
} );
} );
describe( 'not satisfied by', () => {
it( 'same value with a different type', () => {
expect(
( new StrictEqualTo( 0 ) ).isSatisfiedBy( '0' )
).toBeFalsy();
} );
it( 'different value', () => {
expect(
( new StrictEqualTo( 0 ) ).isSatisfiedBy( 1 )
).toBeFalsy();
} );
} );
it( 'sugar works', () => {
const sugar = strictEqualTo( 'h' );
const noSugar = new StrictEqualTo( 'h' );
expect( sameTypeAs( sugar ).isSatisfiedBy( noSugar ) ).toBeTruthy();
} );
} );