Skip to content

Commit

Permalink
Add class tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JvJefke committed Nov 15, 2017
1 parent 0a77533 commit 35d4398
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
12 changes: 12 additions & 0 deletions testLib/ClassA.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class A {
get prop1() {
return "A"
}
get prop2() {
return "something"
}

method2() { return "testA"; }
}

module.exports = A;
13 changes: 13 additions & 0 deletions testLib/ClassB.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const AClass = require("./ClassA");

class ClassB extends AClass {
get prop1() {
return "B";
}

method1() {
return "testB";
}
}

module.exports = ClassB;
13 changes: 13 additions & 0 deletions testLib/sharedTestCases.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,4 +390,17 @@ module.exports = function () {
expect(constModule.dirname).to.equal(require("./constModule").dirname);
});

it("should be possible to create a class", function() {
var BClass = rewire("./ClassB");

expect(function() {
new BClass();
}).to.not.throw;

var b = new BClass();

expect(b.prop1).to.equal("B");
expect(b.prop2).to.equal("something")
});

};

0 comments on commit 35d4398

Please sign in to comment.