(challenge: Challenge)
| 236 | * @returns {object} The challenge object with fixed properties |
| 237 | */ |
| 238 | export function fixChallengeProperties(challenge: Challenge) { |
| 239 | const fixedChallenge = { |
| 240 | ...challenge |
| 241 | }; |
| 242 | |
| 243 | if (challenge.challengeFiles) { |
| 244 | fixedChallenge.challengeFiles = challengeFilesToPolys( |
| 245 | challenge.challengeFiles |
| 246 | ); |
| 247 | } |
| 248 | if (challenge.solutions?.length) { |
| 249 | // The test runner needs the solutions to be arrays of polyvinyls so it |
| 250 | // can sort them correctly. |
| 251 | fixedChallenge.solutions = challenge.solutions.map(challengeFilesToPolys); |
| 252 | } |
| 253 | return fixedChallenge; |
| 254 | } |
| 255 | |
| 256 | /** |
| 257 | * Finalizes a challenge by fixing properties and adding meta information |
no test coverage detected