@@ -21,8 +21,7 @@ it("should evaluate the options argument of an import() with a static request",
2121 expect ( log ) . toEqual ( [ "options" ] ) ;
2222} ) ;
2323
24- it ( "should reject an import() whose options are not an object" , async ( ) => {
25- await expect ( import ( "./a.js" , 1 ) ) . rejects . toThrow ( TypeError ) ;
24+ it ( "should reject a computed-request import() whose options are not an object" , async ( ) => {
2625 await expect ( import ( `./${ "a" } .js` , 1 ) ) . rejects . toThrow ( TypeError ) ;
2726} ) ;
2827
@@ -37,3 +36,28 @@ it("should evaluate an options object whose keys are not import attributes", asy
3736 expect ( module . default ) . toBe ( 42 ) ;
3837 expect ( log ) . toEqual ( [ "effect" ] ) ;
3938} ) ;
39+
40+ it ( "should reject an import() whose options are not an object" , async ( ) => {
41+ await expect ( import ( "./a.js" , 1 ) ) . rejects . toThrow (
42+ "The second argument to import() must be an object"
43+ ) ;
44+ await expect ( import ( "./a.js" , null ) ) . rejects . toThrow (
45+ "The second argument to import() must be an object"
46+ ) ;
47+ } ) ;
48+
49+ it ( "should reject an import() whose 'with' option is not an object" , async ( ) => {
50+ await expect ( import ( "./a.js" , { with : 1 } ) ) . rejects . toThrow (
51+ "The 'with' option must be an object"
52+ ) ;
53+ } ) ;
54+
55+ it ( "should reject an import() whose attribute values are not strings" , async ( ) => {
56+ await expect ( import ( "./a.js" , { with : { type : 1 } } ) ) . rejects . toThrow (
57+ "Import attribute values must be strings"
58+ ) ;
59+ const name = "a" ;
60+ await expect (
61+ import ( `./${ name } .js` , { with : { type : 1 } } )
62+ ) . rejects . toThrow ( "Import attribute values must be strings" ) ;
63+ } ) ;
0 commit comments