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

remove.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
59
import { remove } from './remove.js'
test('happy', () => { const inputs = [ /foo/, /not\shere/, /also/, 'bar' ] const text = 'foo bar baz foo'
const result = remove(inputs)(text) const expectedResult = 'baz foo'
expect(result).toEqual(expectedResult)})
test('with strings + curry', () => { const inputs = [ 'foo', 'bar' ] const text = 'foo bar baz foo'
const result = remove(inputs)(text) const expectedResult = 'baz foo'
expect(result).toEqual(expectedResult)})
test('with strings and regex', () => { const inputs = [ /foo/g, 'bar' ] const text = 'foo bar baz foo'
const result = remove(inputs, text) const expectedResult = 'baz'
expect(result).toEqual(expectedResult)})
test('text is not string', () => { const inputs = [ /foo/g, 'bar' ] const text = null
expect(() => remove(inputs, text)).toThrowErrorMatchingInlineSnapshot('"R.remove requires string not Null"')})
test('with regexes', () => { const inputs = [ /foo/g, /bar/ ] const text = 'foo bar baz foo'
const result = remove(inputs, text) const expectedResult = 'baz'
expect(result).toEqual(expectedResult)})
test('with single rule', () => { const inputs = /foo/g const text = 'foo bar baz foo'
const result = remove(inputs, text) const expectedResult = ' bar baz '
expect(result).toEqual(expectedResult)})
rambda

Version Info

Tagged at
2 months ago