utils/ts-src/extractFromObj.test.ts
Martin Donnelly c30b36b3f6 init
2020-11-17 11:16:34 +00:00

14 lines
395 B
TypeScript

import { extractFromObj } from './extractFromObj';
test('It should correctly extract values', function () {
const o = { a: 1, b: 2 };
expect(extractFromObj(o, ['a'])).toEqual({ a: 1 });
});
test('It should correctly extract more complex structure', function () {
const o = { a: { bob: 1, steve: 2 }, b: 2 };
expect(extractFromObj(o, ['a'])).toEqual({ a: { bob: 1, steve: 2 } });
});