Skip to content

Implement exercise isbn-verifier#366

Merged
matthewmorgan merged 1 commit intoexercism:masterfrom
MattH-be:master
Oct 28, 2017
Merged

Implement exercise isbn-verifier#366
matthewmorgan merged 1 commit intoexercism:masterfrom
MattH-be:master

Conversation

@MattH-be
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Contributor

@matthewmorgan matthewmorgan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MattH-be Looks great! One suggestion (not mandatory) and one question for you.

Comment thread exercises/isbn-verifier/example.js Outdated
isValid() {
if (!this.isbn.match(/^(\d{9}[\dxX])$/)) return false;

const digits = this.isbn.split('');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps use the ES6 spread operator:

const digits = [...this.isbn];

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed in a commit. Using the spread operator is indeed the correct syntax in this instance.

test('valid isbn number', () => {
const isbn = new ISBN('3-598-21508-8');

expect(isbn.isValid()).toBeTruthy();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why '.toBeTruthy()' instead of .toEqual(true)? Did you want to leave the tests open to someone returning something other than a boolean true? Just curious...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're correct. In this case we only want to get true or false, so I've changed it to all use .toEqual

@matthewmorgan
Copy link
Copy Markdown
Contributor

Nice job-- all the canonical tests are covered and the PR otherwise looks great.

One last thing-- would you mind squashing your commits to one? If you need any hep with this, please let me know, I'd be happy to help.

@MattH-be
Copy link
Copy Markdown
Contributor Author

That should've done it.

@matthewmorgan matthewmorgan merged commit 3d8b094 into exercism:master Oct 28, 2017
@matthewmorgan
Copy link
Copy Markdown
Contributor

Nice work! Thanks again 🥇

MattH-be added a commit to MattH-be/ecmascript that referenced this pull request Oct 30, 2017
Grouped all tests under a single describe

Ordered the tests in a more logical way.
All tests except the first one are skipped.

Removed mention of enabling tests by changing xdescribe to describe.

Implement exercise isbn-verifier (exercism#366)

[Housekeeping] Upgrade jest (exercism#368)

* Use `package-lock.json` instead of `yarn.lock`

* Upgrade jest and babel-jest to latest versions

Jest to 21.2.1
babel-jest to 21.2.0

Change Exercise is now ECMAScript ready (exercism#362)

Transpose Exercise is ECMAScript ready (exercism#364)

Upgrade jest

Protein Translation is ECMAScript ready (exercism#365) (exercism#365)

Update  setup links in all READMEs (exercism#371)

Update all setup links in exercise READMEs from http://exercism.io/languages/ecmascript to http://exercism.io/languages/ecmascript/installation

Closes exercism#370

Updated setup link
MattH-be added a commit to MattH-be/ecmascript that referenced this pull request Oct 31, 2017
Grouped all tests under a single describe

Ordered the tests in a more logical way.
All tests except the first one are skipped.

Removed mention of enabling tests by changing xdescribe to describe.

Implement exercise isbn-verifier (exercism#366)

[Housekeeping] Upgrade jest (exercism#368)

* Use `package-lock.json` instead of `yarn.lock`

* Upgrade jest and babel-jest to latest versions

Jest to 21.2.1
babel-jest to 21.2.0

Change Exercise is now ECMAScript ready (exercism#362)

Transpose Exercise is ECMAScript ready (exercism#364)

Upgrade jest

Protein Translation is ECMAScript ready (exercism#365) (exercism#365)

Update  setup links in all READMEs (exercism#371)

Update all setup links in exercise READMEs from http://exercism.io/languages/ecmascript to http://exercism.io/languages/ecmascript/installation

Closes exercism#370

Updated setup link
matthewmorgan pushed a commit that referenced this pull request Oct 31, 2017
Grouped all tests under a single describe

Ordered the tests in a more logical way.
All tests except the first one are skipped.

Removed mention of enabling tests by changing xdescribe to describe.

Implement exercise isbn-verifier (#366)

[Housekeeping] Upgrade jest (#368)

* Use `package-lock.json` instead of `yarn.lock`

* Upgrade jest and babel-jest to latest versions

Jest to 21.2.1
babel-jest to 21.2.0

Change Exercise is now ECMAScript ready (#362)

Transpose Exercise is ECMAScript ready (#364)

Upgrade jest

Protein Translation is ECMAScript ready (#365) (#365)

Update  setup links in all READMEs (#371)

Update all setup links in exercise READMEs from http://exercism.io/languages/ecmascript to http://exercism.io/languages/ecmascript/installation

Closes #370

Updated setup link
laurmurclar pushed a commit to laurmurclar/ecmascript that referenced this pull request Nov 4, 2017
laurmurclar pushed a commit to laurmurclar/ecmascript that referenced this pull request Nov 4, 2017
Grouped all tests under a single describe

Ordered the tests in a more logical way.
All tests except the first one are skipped.

Removed mention of enabling tests by changing xdescribe to describe.

Implement exercise isbn-verifier (exercism#366)

[Housekeeping] Upgrade jest (exercism#368)

* Use `package-lock.json` instead of `yarn.lock`

* Upgrade jest and babel-jest to latest versions

Jest to 21.2.1
babel-jest to 21.2.0

Change Exercise is now ECMAScript ready (exercism#362)

Transpose Exercise is ECMAScript ready (exercism#364)

Upgrade jest

Protein Translation is ECMAScript ready (exercism#365) (exercism#365)

Update  setup links in all READMEs (exercism#371)

Update all setup links in exercise READMEs from http://exercism.io/languages/ecmascript to http://exercism.io/languages/ecmascript/installation

Closes exercism#370

Updated setup link
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants