2019-02-14 22:16:34 +00:00
|
|
|
import { tap, expect } from '@pushrocks/tapbundle';
|
2017-02-27 13:05:03 +00:00
|
|
|
|
2019-02-14 22:16:34 +00:00
|
|
|
import { Smartjson, foldDec } from '../ts/index';
|
2017-02-27 13:05:03 +00:00
|
|
|
|
2019-02-14 22:16:34 +00:00
|
|
|
class SomeClass extends Smartjson {
|
|
|
|
@foldDec() thisis: string = 'test';
|
2018-07-23 22:38:54 +00:00
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
console.log(this.saveableProperties);
|
2017-02-27 13:05:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-23 22:38:54 +00:00
|
|
|
let mySomeClass: SomeClass;
|
2017-02-27 13:05:03 +00:00
|
|
|
|
2019-02-14 22:16:34 +00:00
|
|
|
tap.test('should create a Foldable extended instance', async () => {
|
2018-07-23 22:38:54 +00:00
|
|
|
mySomeClass = new SomeClass();
|
|
|
|
expect(mySomeClass).to.be.instanceof(SomeClass);
|
2019-02-14 22:16:34 +00:00
|
|
|
expect(mySomeClass).to.be.instanceof(Smartjson);
|
2018-07-23 22:38:54 +00:00
|
|
|
});
|
2017-02-27 13:05:03 +00:00
|
|
|
|
2019-02-14 22:16:34 +00:00
|
|
|
tap.test('should create a folded object', async () => {
|
2018-07-23 22:38:54 +00:00
|
|
|
let foldedObject = mySomeClass.foldToObject();
|
|
|
|
expect(foldedObject)
|
2019-02-14 22:16:34 +00:00
|
|
|
.property('thisis')
|
|
|
|
.to.equal('test');
|
2018-07-23 22:38:54 +00:00
|
|
|
});
|
2017-02-27 13:05:03 +00:00
|
|
|
|
2019-02-14 22:16:34 +00:00
|
|
|
tap.test('should enfold from object', async () => {
|
|
|
|
mySomeClass.enfoldFromObject({ thisis: 'test2' });
|
2018-07-23 22:38:54 +00:00
|
|
|
expect(mySomeClass)
|
2019-02-14 22:16:34 +00:00
|
|
|
.property('thisis')
|
|
|
|
.to.equal('test2');
|
2018-07-23 22:38:54 +00:00
|
|
|
});
|
|
|
|
|
2019-02-14 22:16:34 +00:00
|
|
|
tap.start();
|