Skip to content

Commit

Permalink
なんらかの値じゃなくて与えた値がそのまま入っていて欲しい
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuniwak committed Aug 1, 2020
1 parent 08c6e91 commit 28fb443
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
7 changes: 6 additions & 1 deletion lib/closedInterval.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
class ClosedInterval {}
class ClosedInterval {
constructor(lowerBound, upperBound) {
this.upperBound = upperBound;
this.lowerBound = lowerBound;
}
}

module.exports.ClosedInterval = ClosedInterval;
22 changes: 15 additions & 7 deletions lib/closedInterval_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@ test("閉区間のインスタンスを作れる", () => {
expect(closedInterval).toBeInstanceOf(ClosedInterval);
});

test("できたインスタンスは下端点をもつ", () => {
const closedInterval = new ClosedInterval();
expect(closedInterval).toHaveProperty('lowerBound');
});
test("できたインスタンスは上端点をもつ", () => {
const closedInterval = new ClosedInterval();
expect(closedInterval).toHaveProperty('upperBound');
describe("できたインスタンスは", () => {
describe("下端点をもつ", () => {
test("なんらかの値がある", () => {
const lowerBound = 0;
const closedInterval = new ClosedInterval(lowerBound);
expect(closedInterval).toHaveProperty('lowerBound', lowerBound);
});
});

test("上端点をもつ", () => {
const anyLowerBound = 0;
const upperBound = 1;
const closedInterval = new ClosedInterval(anyLowerBound, upperBound);
expect(closedInterval).toHaveProperty('upperBound', upperBound);
});
});

0 comments on commit 28fb443

Please sign in to comment.