Skip to content

Commit

Permalink
Fixes the tests (#282)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBuchholz committed Aug 28, 2018
1 parent 76644e6 commit a255f01
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions test/attributes/attributeforinstanceof.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe("attributes/attributeforinstanceof", function () {
} catch (e) {
exceptionCaught = e;
}
assert(exceptionCaught instanceof gpf.Error.ClassAttributeOnly);
assert(exceptionCaught instanceof gpf.Error.RestrictedBaseClassAttribute);
});

it("can't be used on a member of an attribute class", function () {
Expand All @@ -41,32 +41,34 @@ describe("attributes/attributeforinstanceof", function () {
} catch (e) {
exceptionCaught = e;
}
assert(exceptionCaught);
assert(exceptionCaught instanceof gpf.Error.ClassAttributeOnly);
});

describe("When used properly", function () {

var AttributeForA;
var AttributeForA,
attributeForA;

before(function () {
AttributeForA = gpf.define({
$class: "AttributeForA",
$extend: gpf.attributes.Attribute,
$attributes: [onInstanceOfA]
});
attributeForA = new AttributeForA();
});

it("fails definition if used on the wrong class", function () {
var exceptionCaught;
try {
gpf.define({
$class: "NotAChildOfA",
$attributes: [AttributeForA]
$attributes: [attributeForA]
});
} catch (e) {
exceptionCaught = e;
}
assert(exceptionCaught);
assert(exceptionCaught instanceof gpf.Error.RestrictedBaseClassAttribute);
});

it("accepts definition if used on direct child class", function () {
Expand All @@ -75,7 +77,7 @@ describe("attributes/attributeforinstanceof", function () {
gpf.define({
$class: "DirectChildOfA",
$extend: A,
$attributes: [AttributeForA]
$attributes: [attributeForA]
});
} catch (e) {
exceptionCaught = e;
Expand All @@ -89,12 +91,12 @@ describe("attributes/attributeforinstanceof", function () {
var DirectChildOfA = gpf.define({
$class: "DirectChildOfA",
$extend: A,
$attributes: [AttributeForA]
$attributes: [attributeForA]
});
gpf.define({
$class: "SubChildOfA",
$extend: DirectChildOfA,
$attributes: [AttributeForA]
$attributes: [attributeForA]
});
} catch (e) {
exceptionCaught = e;
Expand Down

0 comments on commit a255f01

Please sign in to comment.