Skip to content

Update tests high scores #2689

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

Merged
merged 4 commits into from
Jun 21, 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/high-scores/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"cmccandless",
"ffflorian",
"hayashi-ay",
"jagdish-15",
"SleeplessByte"
],
"files": {
Expand Down
35 changes: 27 additions & 8 deletions exercises/practice/high-scores/.meta/tests.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# 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.

[1035eb93-2208-4c22-bab8-fef06769a73c]
description = "List of scores"
Expand All @@ -12,16 +19,28 @@ description = "Latest score"
description = "Personal best"

[3d996a97-c81c-4642-9afc-80b80dc14015]
description = "Personal top three from a list of scores"
description = "Top 3 scores -> Personal top three from a list of scores"

[1084ecb5-3eb4-46fe-a816-e40331a4e83a]
description = "Personal top highest to lowest"
description = "Top 3 scores -> Personal top highest to lowest"

[e6465b6b-5a11-4936-bfe3-35241c4f4f16]
description = "Personal top when there is a tie"
description = "Top 3 scores -> Personal top when there is a tie"

[f73b02af-c8fd-41c9-91b9-c86eaa86bce2]
description = "Personal top when there are less than 3"
description = "Top 3 scores -> Personal top when there are less than 3"

[16608eae-f60f-4a88-800e-aabce5df2865]
description = "Personal top when there is only one"
description = "Top 3 scores -> Personal top when there is only one"

[2df075f9-fec9-4756-8f40-98c52a11504f]
description = "Top 3 scores -> Latest score after personal top scores"

[809c4058-7eb1-4206-b01e-79238b9b71bc]
description = "Top 3 scores -> Scores after personal top scores"

[ddb0efc0-9a86-4f82-bc30-21ae0bdc6418]
description = "Top 3 scores -> Latest score after personal best"

[6a0fd2d1-4cc4-46b9-a5bb-2fb667ca2364]
description = "Top 3 scores -> Scores after personal best"
28 changes: 28 additions & 0 deletions exercises/practice/high-scores/high-scores.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,33 @@ describe('High Scores Test Suite', () => {
const input = [40];
expect(new HighScores(input).personalTopThree).toEqual([40]);
});

xtest('Latest score after personal top scores', () => {
const input = [70, 50, 20, 30];
const highScores = new HighScores(input);
highScores.personalTopThree;
expect(highScores.latest).toEqual(30);
});

xtest('Scores after personal top scores', () => {
const input = [30, 50, 20, 70];
const highScores = new HighScores(input);
highScores.personalTopThree;
expect(highScores.scores).toEqual(input);
});

xtest('Latest score after personal best', () => {
const input = [20, 70, 15, 25, 30];
const highScores = new HighScores(input);
highScores.personalBest;
expect(highScores.latest).toEqual(30);
});

xtest('Scores after personal best', () => {
const input = [20, 70, 15, 25, 30];
const highScores = new HighScores(input);
highScores.personalBest;
expect(highScores.scores).toEqual(input);
});
});
});