Skip to content

Commit 5e77c62

Browse files
committed
add test
1 parent cd87877 commit 5e77c62

File tree

2 files changed

+5054
-3720
lines changed

2 files changed

+5054
-3720
lines changed

packages/gatsby-plugin-sitemap/src/__tests__/internals.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,29 @@ describe(`gatsby-plugin-sitemap internals tests`, () => {
9797

9898
expect(results).toMatchSnapshot()
9999
})
100+
101+
it(`pageFilter should filter correctly on consecutive runs`, () => {
102+
const allPages = [
103+
{ path: `/to/keep/1` },
104+
{ path: `/to/keep/2` },
105+
{ path: `/404.html` },
106+
]
107+
const filterPages = jest.fn()
108+
109+
const { filteredPages } = pageFilter({
110+
allPages,
111+
filterPages,
112+
excludes: [],
113+
})
114+
expect(filteredPages).toHaveLength(2)
115+
expect(filteredPages).not.toContainEqual({ path: `/404.html` })
116+
117+
const { filteredPages: filteredPages2 } = pageFilter({
118+
allPages,
119+
filterPages,
120+
excludes: [],
121+
})
122+
expect(filteredPages2).toHaveLength(2)
123+
expect(filteredPages2).not.toContainEqual({ path: `/404.html` })
124+
})
100125
})

0 commit comments

Comments
 (0)