test: added test for enumObject.
This commit is contained in:
parent
b64c2a5fba
commit
b97f089bac
24
src/util/__tests__/enumObject.test.ts
Normal file
24
src/util/__tests__/enumObject.test.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { enumObject } from '../objects';
|
||||
|
||||
test('it should ignore and not crash with non-object', () => {
|
||||
expect(Array.from(enumObject('string' as never))).toEqual([]);
|
||||
});
|
||||
|
||||
test('it should ignore and not crash with null', () => {
|
||||
expect(Array.from(enumObject(null))).toEqual([]);
|
||||
});
|
||||
|
||||
test('it be able to iterate object', () => {
|
||||
expect(Array.from(enumObject({ a: '1', b: '2' }))).toMatchInlineSnapshot(`
|
||||
[
|
||||
[
|
||||
"a",
|
||||
"1",
|
||||
],
|
||||
[
|
||||
"b",
|
||||
"2",
|
||||
],
|
||||
]
|
||||
`);
|
||||
});
|
Loading…
Reference in New Issue
Block a user