forked from ramda/ramda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathincludes.js
30 lines (23 loc) · 859 Bytes
/
includes.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
var R = require('../source/index.js');
var eq = require('./shared/eq.js');
var {Just} = require('./shared/Maybe.js');
describe('includes', function() {
it('returns true if an element is in a list', function() {
eq(R.includes(7, [1, 2, 3, 9, 8, 7, 100, 200, 300]), true);
});
it('returns false if an element is not in a list', function() {
eq(R.includes(99, [1, 2, 3, 9, 8, 7, 100, 200, 300]), false);
});
it('returns false for the empty list', function() {
eq(R.includes(1, []), false);
});
it('has R.equals semantics', function() {
eq(R.includes(0, [-0]), false);
eq(R.includes(-0, [0]), false);
eq(R.includes(NaN, [NaN]), true);
eq(R.includes(new Just([42]), [new Just([42])]), true);
});
it('returns true if substring is part of string', function() {
eq(R.includes('ba', 'banana'), true);
});
});