deno.land / x / rambda@v9.1.1 / source / endsWith.spec.js

endsWith.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
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
import { endsWith as endsWithRamda } from 'ramda'
import { compareCombinations } from './_internals/testUtils.js'import { endsWith } from './endsWith.js'
test('with string', () => { expect(endsWith('bar', 'foo-bar')).toBeTrue() expect(endsWith('baz')('foo-bar')).toBeFalse()})
test('use R.equals with array', () => { const list = [ { a : 1 }, { a : 2 }, { a : 3 } ] expect(endsWith({ a : 3 }, list)).toBeFalse(), expect(endsWith([ { a : 3 } ], list)).toBeTrue() expect(endsWith([ { a : 2 }, { a : 3 } ], list)).toBeTrue() expect(endsWith(list, list)).toBeTrue() expect(endsWith([ { a : 1 } ], list)).toBeFalse()})
export const possibleTargets = [ NaN, [ NaN ], /foo/, [ /foo/ ], Promise.resolve(1), [ Promise.resolve(1) ], Error('foo'), [ Error('foo') ],]
export const possibleIterables = [ [ Promise.resolve(1), Promise.resolve(2) ], [ /foo/, /bar/ ], [ NaN ], [ Error('foo'), Error('bar') ],]
describe('brute force', () => { compareCombinations({ fn : endsWith, fnRamda : endsWithRamda, firstInput : possibleTargets, secondInput : possibleIterables, callback : errorsCounters => { expect(errorsCounters).toMatchInlineSnapshot(` { "ERRORS_MESSAGE_MISMATCH": 0, "ERRORS_TYPE_MISMATCH": 0, "RESULTS_MISMATCH": 0, "SHOULD_NOT_THROW": 0, "SHOULD_THROW": 0, "TOTAL_TESTS": 32, } `) }, })})
rambda

Version Info

Tagged at
2 months ago