-
Notifications
You must be signed in to change notification settings - Fork 14
/
omitBy.test.ts
46 lines (39 loc) · 827 Bytes
/
omitBy.test.ts
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
import { describe, expect, it } from 'vitest';
import omitBy from '../omitBy';
describe('test omitBy util function', () => {
it('omit number values', () => {
const symbolValue = Symbol();
const obj = {
a: 1,
b: '2',
c: false,
d: undefined,
e: null,
f: symbolValue,
};
const omitted = omitBy(obj, value => typeof value === 'number');
expect(omitted).toEqual({
b: '2',
c: false,
d: undefined,
e: null,
f: symbolValue,
});
});
it('omit empty string', () => {
const obj = {
a: '1',
b: '2',
c: '',
d: undefined,
e: null,
};
const omitted = omitBy(obj, value => value === '');
expect(omitted).toEqual({
a: '1',
b: '2',
d: undefined,
e: null,
});
});
});