fix(core): update
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
import { tap, expect } from '@pushrocks/tapbundle';
|
||||
|
||||
import { Smartjson, foldDec } from '../ts/index';
|
||||
import * as smartjson from '../ts/index.js';
|
||||
|
||||
class SomeClass extends Smartjson {
|
||||
@foldDec() thisis: string = 'test';
|
||||
class SomeClass extends smartjson.Smartjson {
|
||||
@smartjson.foldDec() thisis: string = 'test';
|
||||
constructor() {
|
||||
super();
|
||||
console.log(this.saveableProperties);
|
||||
@ -14,18 +14,30 @@ let mySomeClass: SomeClass;
|
||||
|
||||
tap.test('should create a Foldable extended instance', async () => {
|
||||
mySomeClass = new SomeClass();
|
||||
expect(mySomeClass).to.be.instanceof(SomeClass);
|
||||
expect(mySomeClass).to.be.instanceof(Smartjson);
|
||||
expect(mySomeClass).toBeInstanceOf(SomeClass);
|
||||
expect(mySomeClass).toBeInstanceOf(smartjson.Smartjson);
|
||||
});
|
||||
|
||||
tap.test('should create a folded object', async () => {
|
||||
let foldedObject = mySomeClass.foldToObject();
|
||||
expect(foldedObject).property('thisis').to.equal('test');
|
||||
expect(foldedObject).property('thisis').toEqual('test');
|
||||
});
|
||||
|
||||
tap.test('should enfold from object', async () => {
|
||||
const mySomeClass2 = SomeClass.enfoldFromObject({ thisis: 'test2' });
|
||||
expect(mySomeClass2).property('thisis').to.equal('test2');
|
||||
expect(mySomeClass2).property('thisis').toEqual('test2');
|
||||
});
|
||||
|
||||
tap.test('should products stable jsons', async () => {
|
||||
const jsonString = smartjson.stringify({
|
||||
a: 1,
|
||||
f: 6,
|
||||
b: 3,
|
||||
c: 3,
|
||||
e: 5,
|
||||
d: 4,
|
||||
});
|
||||
console.log(jsonString);
|
||||
});
|
||||
|
||||
tap.start();
|
||||
|
Reference in New Issue
Block a user