Skip to content

Commit f225eee

Browse files
authored
Update tests phone number (#2694)
* Sync toml file * Update test file * Update proof solution * Configure config.json
1 parent e48964f commit f225eee

File tree

4 files changed

+37
-9
lines changed

4 files changed

+37
-9
lines changed

exercises/practice/phone-number/.meta/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"contributors": [
66
"ankorGH",
77
"draalger",
8+
"jagdish-15",
89
"kytrinyx",
910
"LyleCharlesScott",
1011
"matthewmorgan",

exercises/practice/phone-number/.meta/proof.ci.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ export const clean = (number) => {
1717
}
1818

1919
if (numberLength < 10) {
20-
throw new Error('Incorrect number of digits');
20+
throw new Error('Must not be fewer than 10 digits');
2121
}
2222

2323
if (numberLength > 11) {
24-
throw new Error('More than 11 digits');
24+
throw new Error('Must not be greater than 11 digits');
2525
}
2626

2727
if (strippedNumber.substring(0, 1) === '0') {

exercises/practice/phone-number/.meta/tests.toml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
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
[79666dce-e0f1-46de-95a1-563802913c35]
613
description = "cleans the number"
@@ -13,6 +20,11 @@ description = "cleans numbers with multiple spaces"
1320

1421
[598d8432-0659-4019-a78b-1c6a73691d21]
1522
description = "invalid when 9 digits"
23+
include = false
24+
25+
[2de74156-f646-42b5-8638-0ef1d8b58bc2]
26+
description = "invalid when 9 digits"
27+
reimplements = "598d8432-0659-4019-a78b-1c6a73691d21"
1628

1729
[57061c72-07b5-431f-9766-d97da7c4399d]
1830
description = "invalid when 11 digits does not start with a 1"
@@ -25,12 +37,27 @@ description = "valid when 11 digits and starting with 1 even with punctuation"
2537

2638
[c6a5f007-895a-4fc5-90bc-a7e70f9b5cad]
2739
description = "invalid when more than 11 digits"
40+
include = false
41+
42+
[4a1509b7-8953-4eec-981b-c483358ff531]
43+
description = "invalid when more than 11 digits"
44+
reimplements = "c6a5f007-895a-4fc5-90bc-a7e70f9b5cad"
2845

2946
[63f38f37-53f6-4a5f-bd86-e9b404f10a60]
3047
description = "invalid with letters"
48+
include = false
49+
50+
[eb8a1fc0-64e5-46d3-b0c6-33184208e28a]
51+
description = "invalid with letters"
52+
reimplements = "63f38f37-53f6-4a5f-bd86-e9b404f10a60"
3153

3254
[4bd97d90-52fd-45d3-b0db-06ab95b1244e]
3355
description = "invalid with punctuations"
56+
include = false
57+
58+
[065f6363-8394-4759-b080-e6c8c351dd1f]
59+
description = "invalid with punctuations"
60+
reimplements = "4bd97d90-52fd-45d3-b0db-06ab95b1244e"
3461

3562
[d77d07f8-873c-4b17-8978-5f66139bf7d7]
3663
description = "invalid if area code starts with 0"

exercises/practice/phone-number/phone-number.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('Phone Number', () => {
1717

1818
xtest('invalid when 9 digits', () => {
1919
expect(() => clean('123456789')).toThrow(
20-
new Error('Incorrect number of digits'),
20+
new Error('Must not be fewer than 10 digits'),
2121
);
2222
});
2323

@@ -37,18 +37,18 @@ describe('Phone Number', () => {
3737

3838
xtest('invalid when more than 11 digits', () => {
3939
expect(() => clean('321234567890')).toThrow(
40-
new Error('More than 11 digits'),
40+
new Error('Must not be greater than 11 digits'),
4141
);
4242
});
4343

4444
xtest('invalid with letters', () => {
45-
expect(() => clean('123-abc-7890')).toThrow(
45+
expect(() => clean('523-abc-7890')).toThrow(
4646
new Error('Letters not permitted'),
4747
);
4848
});
4949

5050
xtest('invalid with punctuations', () => {
51-
expect(() => clean('123-@:!-7890')).toThrow(
51+
expect(() => clean('523-@:!-7890')).toThrow(
5252
new Error('Punctuations not permitted'),
5353
);
5454
});

0 commit comments

Comments
 (0)