smartjson/test/test.js
2017-02-27 14:05:03 +01:00

42 lines
3.2 KiB
JavaScript

"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
require("typings-test");
const smartchai_1 = require("smartchai");
const index_1 = require("../dist/index");
class SomeClass extends index_1.Foldable {
constructor() {
super();
this.thisis = 'test';
console.log(this.saveableProperties);
}
}
__decorate([
index_1.foldDec(),
__metadata("design:type", String)
], SomeClass.prototype, "thisis", void 0);
let mySomeClass;
describe('smartjson', function () {
it('should create a Foldable extended instance', function () {
mySomeClass = new SomeClass();
smartchai_1.expect(mySomeClass).to.be.instanceof(SomeClass);
smartchai_1.expect(mySomeClass).to.be.instanceof(index_1.Foldable);
});
it('should create a folded object', function () {
let foldedObject = mySomeClass.foldToObject();
smartchai_1.expect(foldedObject).property('thisis').to.equal('test');
});
it('should enfold from object', function () {
mySomeClass.enfoldFromObject({ thisis: 'test2' });
smartchai_1.expect(mySomeClass).property('thisis').to.equal('test2');
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7QUFBQSx3QkFBcUI7QUFDckIseUNBQWtDO0FBRWxDLHlDQUFpRDtBQUVqRCxlQ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