Skip to content

Commit

Permalink
chore(gatsby): Test sift filtering on date instances (skipped for now) (
Browse files Browse the repository at this point in the history
  • Loading branch information
vladar authored Apr 14, 2020
1 parent 900f31c commit b9e931a
Showing 1 changed file with 27 additions and 0 deletions.
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

0 comments on commit b9e931a

Please sign in to comment.