2018-07-23 22:38:54 +00:00
|
|
|
import { tap, expect } from "@pushrocks/tapbundle";
|
2017-02-27 13:05:03 +00:00
|
|
|
|
2018-07-23 22:38:54 +00:00
|
|
|
import { Foldable, foldDec } from "../dist/index";
|
2017-02-27 13:05:03 +00:00
|
|
|
|
|
|
|
class SomeClass extends Foldable {
|
2018-07-23 22:38:54 +00:00
|
|
|
@foldDec() thisis: string = "test";
|
|
|
|
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
|
|
|
|
2018-07-23 22:38:54 +00:00
|
|
|
tap.test("should create a Foldable extended instance", async () => {
|
|
|
|
mySomeClass = new SomeClass();
|
|
|
|
expect(mySomeClass).to.be.instanceof(SomeClass);
|
|
|
|
expect(mySomeClass).to.be.instanceof(Foldable);
|
|
|
|
});
|
2017-02-27 13:05:03 +00:00
|
|
|
|
2018-07-23 22:38:54 +00:00
|
|
|
tap.test("should create a folded object", async () => {
|
|
|
|
let foldedObject = mySomeClass.foldToObject();
|
|
|
|
expect(foldedObject)
|
|
|
|
.property("thisis")
|
|
|
|
.to.equal("test");
|
|
|
|
});
|
2017-02-27 13:05:03 +00:00
|
|
|
|
2018-07-23 22:38:54 +00:00
|
|
|
tap.test("should enfold from object", async () => {
|
|
|
|
mySomeClass.enfoldFromObject({ thisis: "test2" });
|
|
|
|
expect(mySomeClass)
|
|
|
|
.property("thisis")
|
|
|
|
.to.equal("test2");
|
|
|
|
});
|
|
|
|
|
|
|
|
tap.start()
|