Skip to content

Commit 4c0d94a

Browse files
authored
Syncing test.toml and updating the test code (#2650)
1 parent c5f3778 commit 4c0d94a

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

exercises/practice/space-age/.meta/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"ankorGH",
77
"cmccandless",
88
"draalger",
9+
"jagdish-15",
910
"JesseSingleton",
1011
"jscheffner",
1112
"kytrinyx",

exercises/practice/space-age/.meta/proof.ci.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ const EARTH_TO_OTHER_PLANETS = {
1010
};
1111

1212
export const age = (planet, seconds) => {
13+
if (!EARTH_TO_OTHER_PLANETS[planet]) {
14+
throw new Error('not a planet');
15+
}
16+
1317
const earthYears = seconds / 31557600;
1418
const years = earthYears / EARTH_TO_OTHER_PLANETS[planet];
1519

exercises/practice/space-age/.meta/tests.toml

Lines changed: 13 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
[84f609af-5a91-4d68-90a3-9e32d8a5cd34]
613
description = "age on Earth"
@@ -25,3 +32,6 @@ description = "age on Uranus"
2532

2633
[80096d30-a0d4-4449-903e-a381178355d8]
2734
description = "age on Neptune"
35+
36+
[57b96e2a-1178-40b7-b34d-f3c9c34e4bf4]
37+
description = "invalid planet causes error"

exercises/practice/space-age/space-age.spec.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,8 @@ describe('Space Age', () => {
3333
xtest('age on Neptune', () => {
3434
expect(age('neptune', 1821023456)).toEqual(0.35);
3535
});
36+
37+
xtest('invalid planet causes error', () => {
38+
expect(() => age('Sun', 680804807)).toThrow(new Error('not a planet'));
39+
});
3640
});

0 commit comments

Comments
 (0)