forked from ramda/ramda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstartsWith.js
36 lines (28 loc) · 1.27 KB
/
startsWith.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
31
32
33
34
35
36
var R = require('../source/index.js');
var eq = require('./shared/eq.js');
describe('startsWith', function() {
it('should return true when a string starts with the provided value', function() {
eq(R.startsWith('a', 'abc'), true);
});
it('should return true when a long string starts with the provided value', function() {
eq(R.startsWith('astro', 'astrology'), true);
});
it('should return false when a string does not start with the provided value', function() {
eq(R.startsWith('b', 'abc'), false);
});
it('should return false when a long string does not start with the provided value', function() {
eq(R.startsWith('stro', 'astrology'), false);
});
it('should return true when an array starts with the provided value', function() {
eq(R.startsWith(['a'], ['a', 'b', 'c']), true);
});
it('should return true when an array starts with the provided values', function() {
eq(R.startsWith(['a', 'b'], ['a', 'b', 'c']), true);
});
it('should return false when an array does not start with the provided value', function() {
eq(R.startsWith(['b'], ['a', 'b', 'c']), false);
});
it('should return false when an array does not start with the provided values', function() {
eq(R.startsWith(['b', 'c'], ['a', 'b', 'c']), false);
});
});