smartobject/test/test.smartobject.ts

24 lines
730 B
TypeScript
Raw Normal View History

2022-03-07 14:28:32 +00:00
import { expect, expectAsync, tap} from '@pushrocks/tapbundle';
import * as smartobject from '../ts';
let testSmartobject: smartobject.SmartObject;
tap.test('should create a smartobject', async () => {
const originalObject = {
test: 'hey',
deep: {
yeah: 'so deep',
evendeeper: {
sodeep: 2,
2022-03-08 00:42:39 +00:00
deepArray: ['one array', 'two array']
2022-03-07 14:28:32 +00:00
}
}
}
testSmartobject = new smartobject.SmartObject(originalObject);
testSmartobject.addValueAtFlatPathString('deep.nice', 'yeah that has been added');
console.log(testSmartobject.originalObject);
console.log(testSmartobject.toFlatObject())
expect(testSmartobject.getValueAtFlatPathString('deep.yeah')).toEqual('so deep');
});
tap.start();