diff --git a/integration-tests/artifacts/__tests__/index.js b/integration-tests/artifacts/__tests__/index.js index 630d309d02326..0ab8cfc4530b9 100644 --- a/integration-tests/artifacts/__tests__/index.js +++ b/integration-tests/artifacts/__tests__/index.js @@ -339,7 +339,7 @@ function assertHTMLCorrectness(runNumber) { ) }) - it(`html stitched correct and up to date slice`, () => { + it(`html stitched correctly and slice is up to date slice`, () => { expect(htmlContent).toContain( runNumber < 2 ? `Gatsby Slice Test (before edit)` @@ -357,13 +357,37 @@ function assertHTMLCorrectness(runNumber) { ) }) - it(`html stitched correct and up to date slice`, () => { + 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)` ) }) + + it("node change results in correct HTML for slice", () => { + 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)` + ) + }) + }) + + describe(`/slices/blog-2/`, () => { + let htmlContent + beforeAll(() => { + htmlContent = fs.readFileSync( + path.join(process.cwd(), `public`, `slices`, `blog-2`, `index.html`), + `utf-8` + ) + }) + + it(`uses correct slice when a slice is changed in createPage mappping`, () => { + expect(htmlContent).toContain( + runNumber < 2 ? `Josh Johnson` : `Kyle Mathews` + ) + }) }) } diff --git a/integration-tests/artifacts/gatsby-node.js b/integration-tests/artifacts/gatsby-node.js index 96bcc3097d4f1..47158fd372d3d 100644 --- a/integration-tests/artifacts/gatsby-node.js +++ b/integration-tests/artifacts/gatsby-node.js @@ -150,7 +150,7 @@ exports.sourceNodes = ({ createNodeHelper(`SliceBlogPost`, { id: "blog-2", - authorId: `joshj`, + authorId: runNumber < 2 ? `joshj` : `kylem`, title: "Why do we use it?", content: "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).", @@ -170,14 +170,17 @@ 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.`, + summary: `who lives and works in Michigan building neat things`, twitter: `0xJ05H`, })