Skip to content

Commit 88ce356

Browse files
High-Scores: Add immutability test (#1486)
Add tests for immutability after calling personal best Some solutions sort the array to find the largest. This breaks any subsequent call for recent scores, and isn't as fast as calling max. These two tests call recent and scores to verify that the scores have not changed. * Update canonical-data.json Add missing commas * Update canonical-data.json Removed redundant test that two property strings, rather than one "property": "personalTopThree", "latest", * [CI] Format code Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 2e59675 commit 88ce356

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

exercises/high-scores/canonical-data.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,26 @@
103103
},
104104
"expected": [30, 50, 20, 70],
105105
"scenarios": ["immutable"]
106+
},
107+
{
108+
"uuid": "ddb0efc0-9a86-4f82-bc30-21ae0bdc6418",
109+
"description": "Latest score after personal best",
110+
"property": "latestAfterBest",
111+
"input": {
112+
"scores": [20, 70, 15, 25, 30]
113+
},
114+
"expected": 30,
115+
"scenarios": ["immutable"]
116+
},
117+
{
118+
"uuid": "6a0fd2d1-4cc4-46b9-a5bb-2fb667ca2364",
119+
"description": "Scores after personal best",
120+
"property": "scoresAfterBest",
121+
"input": {
122+
"scores": [20, 70, 15, 25, 30]
123+
},
124+
"expected": [20, 70, 15, 25, 30],
125+
"scenarios": ["immutable"]
106126
}
107127
]
108128
}

0 commit comments

Comments
 (0)