-
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
Conversation
Thank you for the submission, @kuhuisien! I'll review your code shortly, hang tight. |
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.
This is a great attempt, @kuhuisien!
I would like to request a few changes before merging your work. Please review my comments below and make the appropriate changes to your code.
After you update your code locally, follow the instructions to save your changes locally and push your changes to your fork.
When you push your changes to your fork, I'll come back for another review.
There are 34 style guide violations in your contribution. I've marked them with inline comments for your convenience.
Please revisit your code and follow the style guide best practices.
Hint: You might be able to fix some issues automatically by running npm run lint -- --fix
All the tests are passing. Nice job!
src/calculator.test.js
Outdated
@@ -1,20 +1,20 @@ | |||
/* eslint-disable no-unused-expressions */ | |||
const calculator = require('./calculator'); | |||
const calculator = require("./calculator"); |
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)
src/calculator.test.js
Outdated
|
||
describe.skip('_check', () => { | ||
describe("_check", () => { |
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)
src/calculator.test.js
Outdated
beforeEach(() => { | ||
sinon.spy(calculator, '_check'); | ||
sinon.spy(calculator, "_check"); |
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)
src/calculator.test.js
Outdated
}); | ||
|
||
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote.
(learn more)
src/calculator.test.js
Outdated
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", () => { | ||
expect(() => calculator._check(40, "2")).to.throw(TypeError); |
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)
src/calculator.test.js
Outdated
expect(() => calculator.subtract(40, '2')).to.throw(TypeError); | ||
describe("subtract", () => { | ||
it("should throw a TypeError if arguments are not numbers", () => { | ||
expect(() => calculator.subtract(40, "2")).to.throw(TypeError); |
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)
src/calculator.test.js
Outdated
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote.
(learn more)
src/calculator.test.js
Outdated
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote.
(learn more)
src/calculator.test.js
Outdated
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote.
(learn more)
src/calculator.test.js
Outdated
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote.
(learn more)
Thanks for the changes, @kuhuisien. I'm reviewing them now. |
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.
LGTM 👍
Thanks for your contribution @kuhuisien!
Your code style completely follows the style guide. Nice job!
All the tests are passing. Nice job!
🎉 You did it! 🎉You're an open source contributor now! Whether this was your first pull request, or you’re just looking for new ways to contribute, I hope you’re inspired to take action. Don't forget to say thanks when a maintainer puts effort into helping you, even if a contribution doesn't get accepted. Open source is made by people like you: one issue, pull request, comment, and +1 at a time. What's next?Find your next project:
Learn from other great community members:
Elevate your Git game:
Questions? Comments? Concerns?I'm always open to feedback. If you had a good time with the exercise, or found some room for improvement, please email me. Want to start over? Just delete your fork. |
Thanks for the feedback! Just wanted to quickly follow up on something I mentioned earlier – would it be helpful if I added a .prettierrc file to standardise formatting preferences across the team? Looking forward to your input! |
This pull request addressed issue #1 by optimized calculators.js to remove duplicated code.
Note: My code editor’s formatting settings caused unintended formatting changes, which I reverted in my last commit.
To prevent such issues in the future, I’d like to ask:
Would it be helpful if I add a .prettierrc file to standardize formatting preferences across the team?
Looking forward to your feedback!