mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-15 01:01:43 +10:00
Updated Gatsby mock: fluid images returned by useStaticQuery
This commit is contained in:
@ -1,8 +1,28 @@
|
|||||||
const React = require(`react`);
|
import React from 'react';
|
||||||
const gatsby = jest.requireActual(`gatsby`);
|
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 = {
|
module.exports = {
|
||||||
...gatsby,
|
...Gatsby,
|
||||||
graphql: jest.fn(),
|
graphql: jest.fn(),
|
||||||
Link: jest.fn().mockImplementation(({ to, ...rest }) =>
|
Link: jest.fn().mockImplementation(({ to, ...rest }) =>
|
||||||
React.createElement(`a`, {
|
React.createElement(`a`, {
|
||||||
@ -22,13 +42,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
file: {
|
file: {
|
||||||
childImageSharp: {
|
childImageSharp: {
|
||||||
fluid(maxWidth = 512) {
|
fluid: fluidImagesShapeMock[0],
|
||||||
base64;
|
|
||||||
aspectRatio;
|
|
||||||
src;
|
|
||||||
srcSet;
|
|
||||||
sizes;
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user