Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(gatsby): Test sift filtering on date instances (skipped for now) #23096

Merged
merged 1 commit into from
Apr 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions packages/gatsby/src/schema/__tests__/node-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,33 @@ describe(`NodeModel`, () => {
expect(result).toBeDefined()
expect(result.id).toEqual(`post2`)
})

// FIXME: Filters on date instances are not supported yet
// SIFT requires such filters to be expressed as Date instances but we
// don't know if date is stored as `Date` instance or `string`
// so can't really do that
// See https://github.com/crcn/sift.js#date-comparison
it.skip(`queries date instances in nodes`, async () => {
const type = `Post`
const query = {
filter: {
frontmatter: {
date: { lte: `2018-01-01T00:00:00Z` },
},
},
}
const firstOnly = false
nodeModel.replaceTypeKeyValueCache(createFiltersCache())
const result = await nodeModel.runQuery({
query,
firstOnly,
type,
})
expect(result).toBeDefined()
expect(result.length).toEqual(2)
expect(result[0].id).toEqual(`post2`)
expect(result[1].id).toEqual(`post3`)
})
})
})

Expand Down