Skip to content
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

Updating tests isbn-verifier #2589

Merged
merged 1 commit into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions exercises/practice/isbn-verifier/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
],
"contributors": [
"ankorGH",
"jagdish-15",
"ovidiu141",
"pyko",
"SleeplessByte",
Expand Down
27 changes: 20 additions & 7 deletions exercises/practice/isbn-verifier/.meta/tests.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
# This is an auto-generated file. Regular comments will be removed when this
# file is regenerated. Regenerating will not touch any manually added keys,
# so comments can be added in a "comment" key.
# This is an auto-generated file.
#
# Regenerating this file via `configlet sync` will:
# - Recreate every `description` key/value pair
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion)
# - Preserve any other key/value pair
#
# As user-added comments (using the # character) will be removed when this file
# is regenerated, comments can be added via a `comment` key.

[0caa3eac-d2e3-4c29-8df8-b188bc8c9292]
description = "valid isbn number"
description = "valid isbn"

[19f76b53-7c24-45f8-87b8-4604d0ccd248]
description = "invalid isbn check digit"

[4164bfee-fb0a-4a1c-9f70-64c6a1903dcd]
description = "valid isbn number with a check digit of 10"
description = "valid isbn with a check digit of 10"

[3ed50db1-8982-4423-a993-93174a20825c]
description = "check digit is a character other than X"

[9416f4a5-fe01-4b61-a07b-eb75892ef562]
description = "invalid check digit in isbn is not treated as zero"

[c19ba0c4-014f-4dc3-a63f-ff9aefc9b5ec]
description = "invalid character in isbn"
description = "invalid character in isbn is not treated as zero"

[28025280-2c39-4092-9719-f3234b89c627]
description = "X is only valid as a check digit"
Expand Down Expand Up @@ -48,7 +58,10 @@ description = "empty isbn"
description = "input is 9 characters"

[ed6e8d1b-382c-4081-8326-8b772c581fec]
description = "invalid characters are not ignored"
description = "invalid characters are not ignored after checking length"

[daad3e58-ce00-4395-8a8e-e3eded1cdc86]
description = "invalid characters are not ignored before checking length"

[fb5e48d8-7c03-4bfb-a088-b101df16fdc3]
description = "input is too long but contains a valid isbn"
14 changes: 11 additions & 3 deletions exercises/practice/isbn-verifier/isbn-verifier.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@ describe('ISBN Verifier', () => {
expect(isValid('3-598-21508-9')).toEqual(false);
});

xtest('valid isbn number with a check digit of 10', () => {
xtest('valid isbn with a check digit of 10', () => {
expect(isValid('3-598-21507-X')).toEqual(true);
});

xtest('check digit is a character other than X', () => {
expect(isValid('3-598-21507-A')).toEqual(false);
});

xtest('invalid character in isbn', () => {
xtest('invalid check digit in isbn is not treated as zero', () => {
expect(isValid('4-598-21507-B')).toEqual(false);
});

xtest('invalid character in isbn is not treated as zero', () => {
expect(isValid('3-598-P1581-X')).toEqual(false);
});

Expand Down Expand Up @@ -62,10 +66,14 @@ describe('ISBN Verifier', () => {
expect(isValid('134456729')).toEqual(false);
});

xtest('invalid characters are not ignored', () => {
xtest('invalid characters are not ignored after checking length', () => {
expect(isValid('3132P34035')).toEqual(false);
});

xtest('invalid characters are not ignored before checking length', () => {
expect(isValid('3598P215088')).toEqual(false);
});

xtest('input is too long but contains a valid isbn', () => {
expect(isValid('98245726788')).toEqual(false);
});
Expand Down