Skip to content

Commit 4f4f7aa

Browse files
authored
Updating tests isbn-verifier (#2589)
1 parent c14a4f6 commit 4f4f7aa

File tree

3 files changed

+32
-10
lines changed

3 files changed

+32
-10
lines changed

exercises/practice/isbn-verifier/.meta/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
],
55
"contributors": [
66
"ankorGH",
7+
"jagdish-15",
78
"ovidiu141",
89
"pyko",
910
"SleeplessByte",

exercises/practice/isbn-verifier/.meta/tests.toml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
1-
# This is an auto-generated file. Regular comments will be removed when this
2-
# file is regenerated. Regenerating will not touch any manually added keys,
3-
# so comments can be added in a "comment" key.
1+
# This is an auto-generated file.
2+
#
3+
# Regenerating this file via `configlet sync` will:
4+
# - Recreate every `description` key/value pair
5+
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications
6+
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion)
7+
# - Preserve any other key/value pair
8+
#
9+
# As user-added comments (using the # character) will be removed when this file
10+
# is regenerated, comments can be added via a `comment` key.
411

512
[0caa3eac-d2e3-4c29-8df8-b188bc8c9292]
6-
description = "valid isbn number"
13+
description = "valid isbn"
714

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

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

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

24+
[9416f4a5-fe01-4b61-a07b-eb75892ef562]
25+
description = "invalid check digit in isbn is not treated as zero"
26+
1727
[c19ba0c4-014f-4dc3-a63f-ff9aefc9b5ec]
18-
description = "invalid character in isbn"
28+
description = "invalid character in isbn is not treated as zero"
1929

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

5060
[ed6e8d1b-382c-4081-8326-8b772c581fec]
51-
description = "invalid characters are not ignored"
61+
description = "invalid characters are not ignored after checking length"
62+
63+
[daad3e58-ce00-4395-8a8e-e3eded1cdc86]
64+
description = "invalid characters are not ignored before checking length"
5265

5366
[fb5e48d8-7c03-4bfb-a088-b101df16fdc3]
5467
description = "input is too long but contains a valid isbn"

exercises/practice/isbn-verifier/isbn-verifier.spec.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,19 @@ describe('ISBN Verifier', () => {
1010
expect(isValid('3-598-21508-9')).toEqual(false);
1111
});
1212

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

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

21-
xtest('invalid character in isbn', () => {
21+
xtest('invalid check digit in isbn is not treated as zero', () => {
22+
expect(isValid('4-598-21507-B')).toEqual(false);
23+
});
24+
25+
xtest('invalid character in isbn is not treated as zero', () => {
2226
expect(isValid('3-598-P1581-X')).toEqual(false);
2327
});
2428

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

65-
xtest('invalid characters are not ignored', () => {
69+
xtest('invalid characters are not ignored after checking length', () => {
6670
expect(isValid('3132P34035')).toEqual(false);
6771
});
6872

73+
xtest('invalid characters are not ignored before checking length', () => {
74+
expect(isValid('3598P215088')).toEqual(false);
75+
});
76+
6977
xtest('input is too long but contains a valid isbn', () => {
7078
expect(isValid('98245726788')).toEqual(false);
7179
});

0 commit comments

Comments
 (0)