@@ -4,7 +4,7 @@ import { IsoDate, parse } from "./parse.js";
4
4
import { parse as temporalParse } from "./test/temporal.js" ;
5
5
6
6
// This test suite compares with Luxon output for maximum backwards compatibility
7
- import { shouldSkip , VALID_TEST_CASES , INVALID_TEST_CASES , SUPPLIED_TEST_CASES } from './test/utils.js' ;
7
+ import { shouldSkip , VALID_TEST_CASES , VALID_BUT_INVALID_IN_LUXON_TEST_CASES , INVALID_TEST_CASES , SUPPLIED_TEST_CASES } from './test/utils.js' ;
8
8
9
9
// Some test cases from https://moment.github.io/luxon/#/parsing?id=ad-hoc-parsing
10
10
// ISO8601 date parsing https://github.com/11ty/eleventy/issues/3587
@@ -17,10 +17,26 @@ for(let line of VALID_TEST_CASES.split("\n")) {
17
17
// assert.equal(received, expected)
18
18
19
19
// Compare to luxon
20
- assert . equal ( parse ( line ) . toUTCString ( ) , DateTime . fromISO ( line , { zone : "utc" } ) . toJSDate ( ) . toUTCString ( ) ) ;
20
+ assert . equal ( parse ( line ) . toUTCString ( ) , DateTime . fromISO ( line , { zone : "utc" } ) . toJSDate ( ) . toUTCString ( ) , `Invalid compared to luxon for ' ${ line } '` ) ;
21
21
22
22
// Compare to Temporal
23
- assert . equal ( parse ( line ) . toUTCString ( ) , temporalParse ( line ) . toString ( ) ) ;
23
+ assert . equal ( parse ( line ) . toUTCString ( ) , temporalParse ( line ) . toString ( ) , `Invalid compared to Temporal for '${ line } '` ) ;
24
+ } ) ;
25
+ }
26
+
27
+ for ( let line of VALID_BUT_INVALID_IN_LUXON_TEST_CASES . split ( "\n" ) ) {
28
+ if ( shouldSkip ( line ) ) {
29
+ continue ;
30
+ }
31
+
32
+ test ( `Parse ${ line } ` , ( ) => {
33
+ // assert.equal(received, expected)
34
+
35
+ // Should not equal luxon
36
+ assert . notEqual ( parse ( line ) . toUTCString ( ) , DateTime . fromISO ( line , { zone : "utc" } ) . toJSDate ( ) . toUTCString ( ) , `Should not match luxon for '${ line } '` ) ;
37
+
38
+ // Compare to Temporal
39
+ assert . equal ( parse ( line ) . toUTCString ( ) , temporalParse ( line ) . toString ( ) , `Invalid compared to Temporal for '${ line } '` ) ;
24
40
} ) ;
25
41
}
26
42
0 commit comments