Skip to content

Commit

Permalink
Ignore tracedSVG tests on versions != 4
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanoverna committed Dec 7, 2022
1 parent 4ab35b8 commit 3b540ec
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 57 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,16 @@ jobs:
GATSBY_VERSION: ${{ matrix.gatsby-version }}
NODE_VERSION: ${{ matrix.node-version }}
- name: Run tests
if: matrix.os == '4.24.0'
run: |
cat node_modules/gatsby/package.json | grep "\"version\""
yarn test
env:
CI: true
- name: Run tests
if: matrix.os != '4.24.0'
run: |
cat node_modules/gatsby/package.json | grep "\"version\""
yarn test -- --testNamePattern='^(?!tracedSVG)'
env:
CI: true
108 changes: 51 additions & 57 deletions test/graphql.test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
const { render } = require('datocms-structured-text-to-html-string');
const buildQueryExecutor = require('./support/buildQueryExecutor');
const { version } = require('gatsby/package.json');

const gatsbyMajorVersion = parseInt(version.split('.')[0]);

jest.setTimeout(60000);

let executeQuery;
let quit;

beforeAll(async () => {
try {
Expand Down Expand Up @@ -118,68 +114,66 @@ test('focalPoints', async () => {
});

// https:/gatsbyjs/gatsby/discussions/37104
if (gatsbyMajorVersion < 5) {
test('tracedSVG', async () => {
const result = await executeQuery(/* GraphQL */ `
{
datoCmsArticle(originalId: { eq: "7364344" }) {
singleAsset {
fluid(
maxWidth: 150
imgixParams: { w: "150", h: "40", fit: "crop" }
) {
tracedSVG
}
blurhashFluid: fluid(
maxWidth: 150
forceBlurhash: true
imgixParams: { w: "150", h: "40", fit: "crop" }
) {
tracedSVG
}
tracedSvgFluidGatsbyImage: gatsbyImageData(
width: 150
placeholder: TRACED_SVG
layout: CONSTRAINED
imgixParams: { w: "150", h: "40", fit: "crop" }
)
}
assetGallery {
fluid(
maxWidth: 150
imgixParams: { w: "150", h: "40", fit: "crop" }
) {
tracedSVG
}
blurhashFluid: fluid(
maxWidth: 150
forceBlurhash: true
imgixParams: { w: "150", h: "40", fit: "crop" }
) {
tracedSVG
}
tracedSvgFluidGatsbyImage: gatsbyImageData(
width: 150
placeholder: TRACED_SVG
layout: CONSTRAINED
imgixParams: { w: "150", h: "40", fit: "crop" }
)
test('tracedSVG', async () => {
const result = await executeQuery(/* GraphQL */ `
{
datoCmsArticle(originalId: { eq: "7364344" }) {
singleAsset {
fluid(
maxWidth: 150
imgixParams: { w: "150", h: "40", fit: "crop" }
) {
tracedSVG
}
blurhashFluid: fluid(
maxWidth: 150
forceBlurhash: true
imgixParams: { w: "150", h: "40", fit: "crop" }
) {
tracedSVG
}
tracedSvgFluidGatsbyImage: gatsbyImageData(
width: 150
placeholder: TRACED_SVG
layout: CONSTRAINED
imgixParams: { w: "150", h: "40", fit: "crop" }
)
}
assetWhichIsSvg: datoCmsAsset(originalId: { eq: "10015565" }) {
fixed(width: 300) {
assetGallery {
fluid(
maxWidth: 150
imgixParams: { w: "150", h: "40", fit: "crop" }
) {
tracedSVG
}
fluid(maxWidth: 300) {
blurhashFluid: fluid(
maxWidth: 150
forceBlurhash: true
imgixParams: { w: "150", h: "40", fit: "crop" }
) {
tracedSVG
}
tracedSvgFluidGatsbyImage: gatsbyImageData(
width: 150
placeholder: TRACED_SVG
layout: CONSTRAINED
imgixParams: { w: "150", h: "40", fit: "crop" }
)
}
}
assetWhichIsSvg: datoCmsAsset(originalId: { eq: "10015565" }) {
fixed(width: 300) {
tracedSVG
}
fluid(maxWidth: 300) {
tracedSVG
}
}
`);
}
`);

expect(result).toMatchSnapshot();
});
}
expect(result).toMatchSnapshot();
});

test('auto=format', async () => {
const result = await executeQuery(/* GraphQL */ `
Expand Down

0 comments on commit 3b540ec

Please sign in to comment.