File tree 3 files changed +9
-3
lines changed
3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ export interface Assertion<
18
18
> {
19
19
input : A ;
20
20
output : R | ( ( play : ( ...args : A ) => R , input : A ) => R ) ;
21
+ sortOutput ?: boolean ;
21
22
}
22
23
23
24
export interface Challenge <
@@ -27,7 +28,7 @@ export interface Challenge<
27
28
title : string ;
28
29
description : string ;
29
30
example : Example < A , R > ;
30
- assertions : readonly Assertion < A , R > [ ] ;
31
+ assertions : Assertion < A , R > [ ] ;
31
32
assertRules ?: ( playString : string ) => void ;
32
33
context ?: Record < string , unknown > ;
33
34
timeLimitMinutes ?: number ;
Original file line number Diff line number Diff line change @@ -52,9 +52,9 @@ export const getChallenges = async (challengeDir: string) => {
52
52
key,
53
53
solution : fs . readFileSync ( solutionPath , UTF8 ) ,
54
54
...challenge ,
55
- example : `(${ challenge . example . input
55
+ example : `play (${ challenge . example . input
56
56
. map ( formatValue )
57
- . join ( ', ' ) } ) => ${ formatValue ( challenge . example . output ) } `,
57
+ . join ( ', ' ) } ) ==== ${ formatValue ( challenge . example . output ) } `,
58
58
} ;
59
59
} )
60
60
) ;
Original file line number Diff line number Diff line change @@ -81,6 +81,11 @@ process.on('message', (entry: VerifyJob) => {
81
81
)
82
82
: assertion . output ;
83
83
84
+ if ( assertion . sortOutput && Array . isArray ( result ) && Array . isArray ( expected ) ) {
85
+ result . sort ( ) ;
86
+ expected . sort ( )
87
+ }
88
+
84
89
if ( ! lodash . isEqual ( result , expected ) ) {
85
90
throw new Error (
86
91
`Expected ${ formatTypeAndValue (
You can’t perform that action at this time.
0 commit comments