From 2e311812be5bfa8d964c70174b3ab8f5808ce02e Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Thu, 9 Aug 2018 08:39:46 +0200 Subject: [PATCH] Slightly more sensible instance naming in registry tests --- test/registry.js | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/test/registry.js b/test/registry.js index d43f461..9e2bf95 100644 --- a/test/registry.js +++ b/test/registry.js @@ -31,26 +31,26 @@ describe("registry", () => { describe("registry usage", () => { it("should work correctly for types", () => { - let Person = registry.createType("Person", { + let SimplePerson = registry.createType("SimplePerson", { name: dm.string(), - favouriteGift: registry.type("Gift").optional() + favouriteGift: registry.type("SimpleGift").optional() }); - let Gift = registry.createType("Gift", { + let SimpleGift = registry.createType("SimpleGift", { description: dm.string(), - from: registry.type("Person"), - to: registry.type("Person") + from: registry.type("SimplePerson"), + to: registry.type("SimplePerson") }); - let joe = Person({ + let joe = SimplePerson({ name: "Joe" }); - let jane = Person({ + let jane = SimplePerson({ name: "Jane" }); - let flowers = Gift({ + let flowers = SimpleGift({ description: "Flowers", from: jane, to: joe @@ -64,44 +64,44 @@ describe("registry", () => { expect(() => { jane.favouriteGift = "not a gift"; - }).to.throw("Expected an instance of Gift, got a string instead"); + }).to.throw("Expected an instance of SimpleGift, got a string instead"); expect(() => { flowers.to = "not a person"; - }).to.throw("Expected an instance of Person, got a string instead"); + }).to.throw("Expected an instance of SimplePerson, got a string instead"); expect(() => { flowers.to = flowers; - }).to.throw("Expected an instance of Person, got an instance of Gift instead"); + }).to.throw("Expected an instance of SimplePerson, got an instance of SimpleGift instead"); }); it("should work correctly for traits", () => { let Givable = registry.createTrait("Givable", { - from: registry.type("AlsoPerson"), - to: registry.type("AlsoPerson") + from: registry.type("Person"), + to: registry.type("Person") }); - let AlsoPerson = registry.createType("AlsoPerson", { + let Person = registry.createType("Person", { name: dm.string(), favouriteGift: registry.trait("Givable").optional() }); - let AlsoGift = registry.createType("AlsoGift", { + let Gift = registry.createType("Gift", { description: dm.string() }).implements(Givable, { from: dm.slot(), to: dm.slot() }); - let joe = AlsoPerson({ + let joe = Person({ name: "Joe" }); - let jane = AlsoPerson({ + let jane = Person({ name: "Jane" }); - let flowers = AlsoGift({ + let flowers = Gift({ description: "Flowers", from: jane, to: joe @@ -119,11 +119,11 @@ describe("registry", () => { expect(() => { flowers.to = "not a person"; - }).to.throw("Expected an instance of AlsoPerson, got a string instead"); + }).to.throw("Expected an instance of Person, got a string instead"); expect(() => { flowers.to = flowers; - }).to.throw("Expected an instance of AlsoPerson, got an instance of AlsoGift instead"); + }).to.throw("Expected an instance of Person, got an instance of Gift instead"); }); it("should work correctly for type aliases", () => {