1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-23 00:22:19 +01:00
unleash.unleash/frontend/src/utils/deepOmit.test.ts
andreas-unleash 46314d2772
fix: Remove lastSeenAt from useCollaborateData.tsx staleness check (#4461)
Remove the lastSeenAt property when checking for stale data

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
2023-08-10 16:13:24 +03:00

50 lines
1.2 KiB
TypeScript

import { deepOmit } from './deepOmit';
test('should omit all instances of a given field', () => {
const input = {
name: 'some-name',
color: 'blue',
children: {
name: 'some-name',
color: 'blue',
children: {
name: 'some-name',
color: 'blue',
children: {
name: 'some-name',
color: 'blue',
children: {},
},
},
},
};
expect(deepOmit(input, 'name')).toEqual({
color: 'blue',
children: {
color: 'blue',
children: {
color: 'blue',
children: {
color: 'blue',
children: {},
},
},
},
});
expect(deepOmit(input, 'color')).toEqual({
name: 'some-name',
children: {
name: 'some-name',
children: {
name: 'some-name',
children: {
name: 'some-name',
children: {},
},
},
},
});
});