Skip to content

Commit

Permalink
add more assertions
Browse files Browse the repository at this point in the history
add more assertions
  • Loading branch information
marvinjude committed Oct 23, 2022
1 parent 70a4ec3 commit 902fa8e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
28 changes: 26 additions & 2 deletions integration-tests/artifacts/__tests__/index.js
Expand Up @@ -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)`
Expand All @@ -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`
)
})
})
}

Expand Down
9 changes: 6 additions & 3 deletions integration-tests/artifacts/gatsby-node.js
Expand Up @@ -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).",
Expand All @@ -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`,
})

Expand Down

0 comments on commit 902fa8e

Please sign in to comment.