From 6ba419371695868ca95ba530807a49e6b90e797a Mon Sep 17 00:00:00 2001 From: Jude Agboola Date: Sun, 23 Oct 2022 13:13:18 +0400 Subject: [PATCH] add more assertions --- integration-tests/artifacts/__tests__/index.js | 14 +++++++++++++- integration-tests/artifacts/gatsby-node.js | 8 +++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/integration-tests/artifacts/__tests__/index.js b/integration-tests/artifacts/__tests__/index.js index 630d309d02326..ae7d5b793cfb6 100644 --- a/integration-tests/artifacts/__tests__/index.js +++ b/integration-tests/artifacts/__tests__/index.js @@ -357,12 +357,24 @@ function assertHTMLCorrectness(runNumber) { ) }) - it(`html stitched correct and up to date slice`, () => { + it(`uses correct slice when a slice id changes in createPage mappping`, () => { + expect(htmlContent).toContain( + runNumber < 2 ? `Kyle Mathews` : `Josh Johnson` + ) + }) + + it(`html stitched correctly and slice is up to date`, () => { expect(htmlContent).toContain( runNumber < 2 ? `Gatsby Slice Test (before edit)` : `Gatsby Slice Test (after edit)` ) + + expect(htmlContent).toContain( + runNumber < 2 + ? `who lives and works in San Francisco building useful things(before edit)` + : `who lives and works in San Francisco building useful things(after edit)` + ) }) }) } diff --git a/integration-tests/artifacts/gatsby-node.js b/integration-tests/artifacts/gatsby-node.js index 96bcc3097d4f1..020e630d71219 100644 --- a/integration-tests/artifacts/gatsby-node.js +++ b/integration-tests/artifacts/gatsby-node.js @@ -141,7 +141,7 @@ exports.sourceNodes = ({ createNodeHelper(`SliceBlogPost`, { id: "blog-1", - authorId: `kylem`, + authorId: runNumber < 2 ? `kylem` : `joshj`, title: "What is Lorem Ipsum?", content: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum", @@ -170,14 +170,16 @@ exports.sourceNodes = ({ createNodeHelper(`SliceBlogPostAuthor`, { name: `Kyle Mathews`, id: `kylem`, - summary: `who lives and works in San Francisco building useful things.`, + summary: + runNumber < 2 + ? `who lives and works in San Francisco building useful things(before edit).` + : `who lives and works in San Francisco building useful things(after edit).`, twitter: `kylemathews`, }) createNodeHelper(`SliceBlogPostAuthor`, { name: `Josh Johnson`, id: `joshj`, - summary: `who lives and works in Michigan building neat things.`, twitter: `0xJ05H`, })