iridium
Advanced tools
Comparing version 7.1.5 to 7.1.6
@@ -6,2 +6,3 @@ "use strict"; | ||
const Skmatc = require("skmatc"); | ||
const Instance_1 = require("./Instance"); | ||
const Transforms_1 = require("./Transforms"); | ||
@@ -93,3 +94,3 @@ /** | ||
return function (target, property = "$document") { | ||
let staticTarget = (target.constructor || target); | ||
let staticTarget = (target instanceof Instance_1.Instance && target.constructor || target); | ||
staticTarget.transforms = _.clone(staticTarget.transforms || {}); | ||
@@ -96,0 +97,0 @@ staticTarget.transforms[property] = { |
@@ -141,15 +141,30 @@ "use strict"; | ||
describe("Transform", () => { | ||
it("should not remove existing entries in the transforms object", () => { | ||
chai.expect(Test.transforms).to.exist.and.have.property("_id").with.property("fromDB").which.is.a("function"); | ||
chai.expect(Test.transforms).to.exist.and.have.property("_id").with.property("toDB").which.is.a("function"); | ||
describe("on a property", () => { | ||
it("should not remove existing entries in the transforms object", () => { | ||
chai.expect(Test.transforms).to.exist.and.have.property("_id").with.property("fromDB").which.is.a("function"); | ||
chai.expect(Test.transforms).to.exist.and.have.property("_id").with.property("toDB").which.is.a("function"); | ||
}); | ||
it("should populate the constructor's transforms object", () => { | ||
chai.expect(Test.transforms).to.exist.and.have.property("email").with.property("fromDB").which.is.a("function"); | ||
chai.expect(Test.transforms).to.exist.and.have.property("email").with.property("toDB").which.is.a("function"); | ||
}); | ||
it("should not pollute the parent's transforms object", () => { | ||
chai.expect(Iridium.Instance.transforms).to.exist.and.not.have.property("email"); | ||
}); | ||
}); | ||
it("should populate the constructor's transforms object", () => { | ||
chai.expect(Test.transforms).to.exist.and.have.property("email").with.property("fromDB").which.is.a("function"); | ||
chai.expect(Test.transforms).to.exist.and.have.property("email").with.property("toDB").which.is.a("function"); | ||
describe("on a class", () => { | ||
it("should not remove existing entries in the transforms object", () => { | ||
chai.expect(Test.transforms).to.exist.and.have.property("_id").with.property("fromDB").which.is.a("function"); | ||
chai.expect(Test.transforms).to.exist.and.have.property("_id").with.property("toDB").which.is.a("function"); | ||
}); | ||
it("should populate the constructor's transforms object", () => { | ||
chai.expect(Test.transforms).to.exist.and.have.property("$document").with.property("fromDB").which.is.a("function"); | ||
chai.expect(Test.transforms).to.exist.and.have.property("$document").with.property("toDB").which.is.a("function"); | ||
}); | ||
it("should not pollute the parent's transforms object", () => { | ||
chai.expect(Iridium.Instance.transforms).to.exist.and.not.have.property("$document"); | ||
}); | ||
}); | ||
it("should not pollute the parent's transforms object", () => { | ||
chai.expect(Iridium.Instance.transforms).to.exist.and.not.have.property("email"); | ||
}); | ||
}); | ||
}); | ||
//# sourceMappingURL=Decorators.js.map |
{ | ||
"name": "iridium", | ||
"version": "7.1.5", | ||
"version": "7.1.6", | ||
"author": "Benjamin Pannell <admin@sierrasoftworks.com>", | ||
@@ -5,0 +5,0 @@ "description": "A custom lightweight ORM for MongoDB designed for power-users", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
706769
7612