mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-14 16:51:33 +10:00
Updated Gatsby mock: fluid images returned by useStaticQuery
This commit is contained in:
@ -1,8 +1,28 @@
|
||||
const React = require(`react`);
|
||||
const gatsby = jest.requireActual(`gatsby`);
|
||||
import React from 'react';
|
||||
const Gatsby = jest.requireActual('gatsby');
|
||||
|
||||
const fluidImagesShapeMock = [
|
||||
{
|
||||
aspectRatio: 2,
|
||||
src: `test_image.jpg`,
|
||||
srcSet: `some srcSet`,
|
||||
srcSetWebp: `some srcSetWebp`,
|
||||
sizes: `(max-width: 600px) 100vw, 600px`,
|
||||
base64: `string_of_base64`,
|
||||
},
|
||||
{
|
||||
aspectRatio: 3,
|
||||
src: `test_image_2.jpg`,
|
||||
srcSet: `some other srcSet`,
|
||||
srcSetWebp: `some other srcSetWebp`,
|
||||
sizes: `(max-width: 600px) 100vw, 600px`,
|
||||
base64: `string_of_base64`,
|
||||
media: `only screen and (min-width: 768px)`,
|
||||
},
|
||||
];
|
||||
|
||||
module.exports = {
|
||||
...gatsby,
|
||||
...Gatsby,
|
||||
graphql: jest.fn(),
|
||||
Link: jest.fn().mockImplementation(({ to, ...rest }) =>
|
||||
React.createElement(`a`, {
|
||||
@ -22,13 +42,7 @@ module.exports = {
|
||||
},
|
||||
file: {
|
||||
childImageSharp: {
|
||||
fluid(maxWidth = 512) {
|
||||
base64;
|
||||
aspectRatio;
|
||||
src;
|
||||
srcSet;
|
||||
sizes;
|
||||
},
|
||||
fluid: fluidImagesShapeMock[0],
|
||||
},
|
||||
},
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user