forked from jsmapr1/simplifying-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfor.spec.js
More file actions
73 lines (60 loc) · 2.42 KB
/
for.spec.js
File metadata and controls
73 lines (60 loc) · 2.42 KB
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
import expect from 'expect';
import {
checkConflicts,
firms,
} from './for';
import {
checkConflicts as checkIn,
firms as firmsIn,
} from './forin';
import {
checkConflicts as checkConflictsFull,
findConflicts,
} from './full';
import {
checkConflicts as checkConflictsTrad,
} from './traditional';
describe('for loop on Map', () => {
it('should return false on negative result', () => {
const soundscapeUnavailable = id => id !== 23;
expect(checkConflicts(firms, soundscapeUnavailable)).toEqual('Soundscaping Source is not available');
});
it('should return false on negative result for full with find', () => {
const soundscapeUnavailable = id => id !== 23;
expect(findConflicts(firms, soundscapeUnavailable)).toEqual('Soundscaping Source is not available');
});
it('should return false on negative result for full', () => {
const soundscapeUnavailable = id => id !== 23;
expect(checkConflictsFull(firms, soundscapeUnavailable)).toEqual('Soundscaping Source is not available');
});
it('should return false on negative result for traditional', () => {
const soundscapeUnavailable = id => id !== 23;
expect(checkConflictsTrad(firms, soundscapeUnavailable)).toEqual('Soundscaping Source is not available');
});
it('should return true on positive result', () => {
const alwaysTrue = id => id;
expect(checkConflicts(firms, alwaysTrue)).toEqual('All firms are available');
});
it('should return true on positive result for full', () => {
const alwaysTrue = id => id;
expect(checkConflictsFull(firms, alwaysTrue)).toEqual('All firms are available');
});
it('should return true on positive result for full with find', () => {
const alwaysTrue = id => id;
expect(findConflicts(firms, alwaysTrue)).toEqual('All firms are available');
});
it('should return true on positive result for full', () => {
const alwaysTrue = id => id;
expect(checkConflictsTrad(firms, alwaysTrue)).toEqual('All firms are available');
});
});
describe('for loop on objects', () => {
it('should return false on negative result for traditional', () => {
const soundscapeUnavailable = id => id !== 23;
expect(checkIn(firmsIn, soundscapeUnavailable)).toEqual('Soundscaping Source is not available');
});
it('should return true on positive result', () => {
const alwaysTrue = id => id;
expect(checkIn(firmsIn, alwaysTrue)).toEqual('All firms are available');
});
});