-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement_check #2379
Implement_check #2379
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
/* eslint-disable no-unused-expressions */ | ||
const calculator = require('./calculator'); | ||
const calculator = require("./calculator"); | ||
|
||
describe.skip('_check', () => { | ||
describe("_check", () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strings must use singlequote. |
||
beforeEach(() => { | ||
sinon.spy(calculator, '_check'); | ||
sinon.spy(calculator, "_check"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strings must use singlequote. |
||
}); | ||
|
||
afterEach(() => { | ||
calculator._check.restore(); | ||
}); | ||
|
||
it('should throw a TypeError if arguments are not numbers', () => { | ||
expect(() => calculator._check(40, '2')).to.throw(TypeError); | ||
it("should throw a TypeError if arguments are not numbers", () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strings must use singlequote. |
||
expect(() => calculator._check(40, "2")).to.throw(TypeError); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strings must use singlequote. |
||
expect(() => calculator._check(40, [])).to.throw(TypeError); | ||
expect(() => calculator._check(40, {})).to.throw(TypeError); | ||
expect(() => calculator._check('40', 2)).to.throw(TypeError); | ||
expect(() => calculator._check("40", 2)).to.throw(TypeError); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strings must use singlequote. |
||
expect(() => calculator._check([], 2)).to.throw(TypeError); | ||
expect(() => calculator._check({}, 2)).to.throw(TypeError); | ||
}); | ||
|
@@ -44,94 +44,94 @@ describe.skip('_check', () => { | |
}); | ||
}); | ||
|
||
describe('add', () => { | ||
it('should throw a TypeError if arguments are not numbers', () => { | ||
expect(() => calculator.add(40, '2')).to.throw(TypeError); | ||
describe("add", () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strings must use singlequote. |
||
it("should throw a TypeError if arguments are not numbers", () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strings must use singlequote. |
||
expect(() => calculator.add(40, "2")).to.throw(TypeError); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strings must use singlequote. |
||
expect(() => calculator.add(40, [])).to.throw(TypeError); | ||
expect(() => calculator.add(40, {})).to.throw(TypeError); | ||
expect(() => calculator.add('40', 2)).to.throw(TypeError); | ||
expect(() => calculator.add("40", 2)).to.throw(TypeError); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strings must use singlequote. |
||
expect(() => calculator.add([], 2)).to.throw(TypeError); | ||
expect(() => calculator.add({}, 2)).to.throw(TypeError); | ||
}); | ||
|
||
it('should add two positive numbers', () => { | ||
it("should add two positive numbers", () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strings must use singlequote. |
||
expect(calculator.add(40, 2)).to.equal(42); | ||
}); | ||
|
||
it('should add two negative numbers', () => { | ||
it("should add two negative numbers", () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strings must use singlequote. |
||
expect(calculator.add(-40, -2)).to.equal(-42); | ||
}); | ||
|
||
it('should add one positive number and one negative number', () => { | ||
it("should add one positive number and one negative number", () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strings must use singlequote. |
||
expect(calculator.add(44, -2)).to.equal(42); | ||
}); | ||
}); | ||
|
||
describe('subtract', () => { | ||
it('should throw a TypeError if arguments are not numbers', () => { | ||
expect(() => calculator.subtract(40, '2')).to.throw(TypeError); | ||
describe("subtract", () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strings must use singlequote. |
||
it("should throw a TypeError if arguments are not numbers", () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strings must use singlequote. |
||
expect(() => calculator.subtract(40, "2")).to.throw(TypeError); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strings must use singlequote. |
||
expect(() => calculator.subtract(40, [])).to.throw(TypeError); | ||
expect(() => calculator.subtract(40, {})).to.throw(TypeError); | ||
expect(() => calculator.subtract('40', 2)).to.throw(TypeError); | ||
expect(() => calculator.subtract("40", 2)).to.throw(TypeError); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strings must use singlequote. |
||
expect(() => calculator.subtract([], 2)).to.throw(TypeError); | ||
expect(() => calculator.subtract({}, 2)).to.throw(TypeError); | ||
}); | ||
|
||
it('should subtract two positive numbers', () => { | ||
it("should subtract two positive numbers", () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strings must use singlequote. |
||
expect(calculator.subtract(44, 2)).to.equal(42); | ||
}); | ||
|
||
it('should subtract two negative numbers', () => { | ||
it("should subtract two negative numbers", () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strings must use singlequote. |
||
expect(calculator.subtract(-44, -2)).to.equal(-42); | ||
}); | ||
|
||
it('should subtract one positive number and one negative number', () => { | ||
it("should subtract one positive number and one negative number", () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strings must use singlequote. |
||
expect(calculator.subtract(40, -2)).to.equal(42); | ||
}); | ||
}); | ||
|
||
describe('multiply', () => { | ||
it('should throw a TypeError if arguments are not numbers', () => { | ||
expect(() => calculator.multiply(40, '2')).to.throw(TypeError); | ||
describe("multiply", () => { | ||
it("should throw a TypeError if arguments are not numbers", () => { | ||
expect(() => calculator.multiply(40, "2")).to.throw(TypeError); | ||
expect(() => calculator.multiply(40, [])).to.throw(TypeError); | ||
expect(() => calculator.multiply(40, {})).to.throw(TypeError); | ||
expect(() => calculator.multiply('40', 2)).to.throw(TypeError); | ||
expect(() => calculator.multiply("40", 2)).to.throw(TypeError); | ||
expect(() => calculator.multiply([], 2)).to.throw(TypeError); | ||
expect(() => calculator.multiply({}, 2)).to.throw(TypeError); | ||
}); | ||
|
||
it('should multiply two positive numbers', () => { | ||
it("should multiply two positive numbers", () => { | ||
expect(calculator.multiply(6, 7)).to.equal(42); | ||
}); | ||
|
||
it('should multiply two negative numbers', () => { | ||
it("should multiply two negative numbers", () => { | ||
expect(calculator.multiply(-6, -7)).to.equal(42); | ||
}); | ||
|
||
it('should multiply one positive number and one negative number', () => { | ||
it("should multiply one positive number and one negative number", () => { | ||
expect(calculator.multiply(6, -7)).to.equal(-42); | ||
}); | ||
}); | ||
|
||
describe('divide', () => { | ||
it('should throw a TypeError if arguments are not numbers', () => { | ||
expect(() => calculator.divide(40, '2')).to.throw(TypeError); | ||
describe("divide", () => { | ||
it("should throw a TypeError if arguments are not numbers", () => { | ||
expect(() => calculator.divide(40, "2")).to.throw(TypeError); | ||
expect(() => calculator.divide(40, [])).to.throw(TypeError); | ||
expect(() => calculator.divide(40, {})).to.throw(TypeError); | ||
expect(() => calculator.divide('40', 2)).to.throw(TypeError); | ||
expect(() => calculator.divide("40", 2)).to.throw(TypeError); | ||
expect(() => calculator.divide([], 2)).to.throw(TypeError); | ||
expect(() => calculator.divide({}, 2)).to.throw(TypeError); | ||
}); | ||
|
||
it('should divide two positive numbers', () => { | ||
it("should divide two positive numbers", () => { | ||
expect(calculator.divide(84, 2)).to.equal(42); | ||
}); | ||
|
||
it('should divide two negative numbers', () => { | ||
it("should divide two negative numbers", () => { | ||
expect(calculator.divide(-84, -2)).to.equal(42); | ||
}); | ||
|
||
it('should divide one positive number and one negative number', () => { | ||
it("should divide one positive number and one negative number", () => { | ||
expect(calculator.divide(84, -2)).to.equal(-42); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote.
(learn more)