Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
kathmbeck committed Apr 6, 2023
1 parent cd87877 commit 341cd53
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions packages/gatsby-plugin-sitemap/src/__tests__/internals.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,29 @@ describe(`gatsby-plugin-sitemap internals tests`, () => {

expect(results).toMatchSnapshot()
})

it(`pageFilter should filter correctly on consecutive runs`, () => {
const allPages = [
{ path: `/to/keep/1` },
{ path: `/to/keep/2` },
{ path: `/404.html` },
]
const filterPages = jest.fn()

const { filteredPages } = pageFilter({
allPages,
filterPages,
excludes: [],
})
expect(filteredPages).toHaveLength(2)
expect(filteredPages).not.toContainEqual({ path: `/404.html` })

const { filteredPages: filteredPages2 } = pageFilter({
allPages,
filterPages,
excludes: [],
})
expect(filteredPages2).toHaveLength(2)
expect(filteredPages2).not.toContainEqual({ path: `/404.html` })
})
})

0 comments on commit 341cd53

Please sign in to comment.