@@ -12,7 +12,7 @@ const DF = new DataFactory();
1212describe ( 'ConfigConstructor' , ( ) => {
1313 let objectLoader : RdfObjectLoader ;
1414 let componentResources : Record < string , Resource > ;
15- let configConstructorPool : ConfigConstructorPool < any > ;
15+ let configConstructorPool : jest . Mocked < ConfigConstructorPool < any > > ;
1616 let constructor : ConfigConstructor < any > ;
1717 let constructionStrategy : IConstructionStrategy < any > ;
1818 let moduleState : IModuleState ;
@@ -224,7 +224,7 @@ describe('ConfigConstructor', () => {
224224 . toThrowError ( / ^ M i s s i n g k e y i n f i e l d s e n t r y / u) ;
225225 } ) ;
226226
227- it ( 'should throw on IRI key ' , async ( ) => {
227+ it ( 'can use dereferenced IRI values as keys ' , async ( ) => {
228228 const resource = objectLoader . createCompactedResource ( {
229229 fields : {
230230 list : [
@@ -235,8 +235,39 @@ describe('ConfigConstructor', () => {
235235 ] ,
236236 } ,
237237 } ) ;
238+ expect ( await constructor . getArgumentValue ( resource , settings ) ) . toEqual ( {
239+ entries : [
240+ {
241+ key : 'INSTANCE' ,
242+ value : 'ABC' ,
243+ } ,
244+ ] ,
245+ } ) ;
246+ expect ( constructionStrategy . createHash ) . toHaveBeenCalledWith ( {
247+ settings,
248+ entries : [
249+ {
250+ key : 'INSTANCE' ,
251+ value : 'ABC' ,
252+ } ,
253+ ] ,
254+ } ) ;
255+ } ) ;
256+
257+ it ( 'should throw on non-string keys' , async ( ) => {
258+ configConstructorPool . instantiate . mockResolvedValueOnce ( new Error ( 'this is an object' ) ) ;
259+ const resource = objectLoader . createCompactedResource ( {
260+ fields : {
261+ list : [
262+ {
263+ key : `ex:abc` ,
264+ value : '"ABC"' ,
265+ } ,
266+ ] ,
267+ } ,
268+ } ) ;
238269 await expect ( constructor . getArgumentValue ( resource , settings ) ) . rejects
239- . toThrowError ( / ^ I l l e g a l n o n - l i t e r a l k e y \( e x : a b c a s N a m e d N o d e \) i n f i e l d s e n t r y / u) ;
270+ . toThrowError ( / ^ I l l e g a l n o n - s t r i n g k e y \( e x : a b c a s N a m e d N o d e \) i n f i e l d s e n t r y / u) ;
240271 } ) ;
241272
242273 it ( 'should ignore fields without value' , async ( ) => {
0 commit comments