@@ -249,15 +249,15 @@ describe(`gatsby-source-drupal`, () => {
249249 // first call without basicAuth (no fileSystem defined)
250250 // (the first call is actually the 5th because sourceNodes was ran at first with no basicAuth)
251251 expect ( createRemoteFileNode ) . toHaveBeenNthCalledWith (
252- 5 ,
252+ 6 ,
253253 expect . objectContaining ( {
254254 url : urls [ 0 ] ,
255255 auth : { } ,
256256 } )
257257 )
258258 // 2nd call with basicAuth (public: fileSystem defined)
259259 expect ( createRemoteFileNode ) . toHaveBeenNthCalledWith (
260- 6 ,
260+ 7 ,
261261 expect . objectContaining ( {
262262 url : urls [ 1 ] ,
263263 auth : {
@@ -268,15 +268,15 @@ describe(`gatsby-source-drupal`, () => {
268268 )
269269 // 3rd call without basicAuth (s3: fileSystem defined)
270270 expect ( createRemoteFileNode ) . toHaveBeenNthCalledWith (
271- 7 ,
271+ 8 ,
272272 expect . objectContaining ( {
273273 url : urls [ 2 ] ,
274274 auth : { } ,
275275 } )
276276 )
277277 // 4th call with basicAuth (private: fileSystem defined)
278278 expect ( createRemoteFileNode ) . toHaveBeenNthCalledWith (
279- 8 ,
279+ 9 ,
280280 expect . objectContaining ( {
281281 url : urls [ 3 ] ,
282282 auth : {
@@ -289,14 +289,14 @@ describe(`gatsby-source-drupal`, () => {
289289
290290 it ( `Skips File Downloads on initial build` , async ( ) => {
291291 const skipFileDownloads = true
292- expect ( createRemoteFileNode ) . toBeCalledTimes ( 8 )
292+ expect ( createRemoteFileNode ) . toBeCalledTimes ( 10 )
293293 await sourceNodes ( args , { baseUrl, skipFileDownloads } )
294- expect ( createRemoteFileNode ) . toBeCalledTimes ( 8 )
294+ expect ( createRemoteFileNode ) . toBeCalledTimes ( 10 )
295295 } )
296296
297297 it ( `Skips File Downloads on webhook update` , async ( ) => {
298298 const skipFileDownloads = true
299- expect ( createRemoteFileNode ) . toBeCalledTimes ( 8 )
299+ expect ( createRemoteFileNode ) . toBeCalledTimes ( 10 )
300300 const nodeToUpdate = require ( `./fixtures/webhook-file-update.json` ) . data
301301
302302 await handleWebhookUpdate (
@@ -310,7 +310,7 @@ describe(`gatsby-source-drupal`, () => {
310310 }
311311 )
312312
313- expect ( createRemoteFileNode ) . toBeCalledTimes ( 8 )
313+ expect ( createRemoteFileNode ) . toBeCalledTimes ( 10 )
314314 } )
315315
316316 describe ( `Update webhook` , ( ) => {
@@ -641,6 +641,30 @@ describe(`gatsby-source-drupal`, () => {
641641 expect ( probeImageSize ) . toHaveBeenCalled ( )
642642 } )
643643
644+ it ( `should generate Image CDN node data when mimetype is on "mimetype" field` , async ( ) => {
645+ // Reset nodes and test includes relationships.
646+ Object . keys ( nodes ) . forEach ( key => delete nodes [ key ] )
647+
648+ const options = {
649+ baseUrl,
650+ skipFileDownloads : true ,
651+ }
652+
653+ // Call onPreBootstrap to set options
654+ await onPreBootstrap ( args , options )
655+ await sourceNodes ( args , options )
656+
657+ const fileNode = nodes [ createNodeId ( `und.file-5` ) ]
658+ expect ( fileNode ) . toBeDefined ( )
659+ expect ( fileNode . url ) . toEqual (
660+ `http://fixture/sites/default/files/main-image5.png`
661+ )
662+ expect ( fileNode . mimeType ) . toEqual ( `image/png` )
663+ expect ( fileNode . width ) . toEqual ( 100 )
664+ expect ( fileNode . height ) . toEqual ( 100 )
665+ expect ( probeImageSize ) . toHaveBeenCalled ( )
666+ } )
667+
644668 it ( `should not generate required Image CDN node data when imageCDN option is set to false` , async ( ) => {
645669 // Reset nodes and test includes relationships.
646670 Object . keys ( nodes ) . forEach ( key => delete nodes [ key ] )
0 commit comments