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

startsWith.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
import { startsWith as startsWithRamda } from 'ramda'
import { compareCombinations } from './_internals/testUtils.js'import { possibleIterables, possibleTargets } from './endsWith.spec.js'import { startsWith } from './startsWith.js'
test('with string', () => { expect(startsWith('foo', 'foo-bar')).toBeTrue() expect(startsWith('baz')('foo-bar')).toBeFalse()})
test('use R.equals with array', () => { const list = [ { a : 1 }, { a : 2 }, { a : 3 } ] expect(startsWith({ a : 1 }, list)).toBeFalse() expect(startsWith([ { a : 1 } ], list)).toBeTrue() expect(startsWith([ { a : 1 }, { a : 2 } ], list)).toBeTrue() expect(startsWith(list, list)).toBeTrue() expect(startsWith([ { a : 2 } ], list)).toBeFalse()})
describe('brute force', () => { compareCombinations({ fn : startsWith, fnRamda : startsWithRamda, 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