Add test
This commit is contained in:
@ -232,6 +232,8 @@ export interface SearchItem {
|
||||
readAt?: Date
|
||||
savedAt: Date
|
||||
updatedAt?: Date
|
||||
labels?: Label[]
|
||||
highlights?: Highlight[]
|
||||
}
|
||||
|
||||
const keys = ['_id', 'url', 'slug', 'userId', 'uploadFileId', 'state'] as const
|
||||
|
||||
@ -180,6 +180,9 @@ const searchQuery = (keyword = '') => {
|
||||
url
|
||||
createdAt
|
||||
updatedAt
|
||||
highlights {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
pageInfo {
|
||||
@ -1021,6 +1024,15 @@ describe('Article API', () => {
|
||||
expect(res.body.data.search.edges[3].node.id).to.eq(pages[1].id)
|
||||
expect(res.body.data.search.edges[4].node.id).to.eq(pages[0].id)
|
||||
})
|
||||
|
||||
it('should return highlights in pages', async () => {
|
||||
const res = await graphqlRequest(query, authToken).expect(200)
|
||||
|
||||
expect(res.body.data.search.edges[0].node.highlights.length).to.eql(1)
|
||||
expect(res.body.data.search.edges[0].node.highlights[0].id).to.eq(
|
||||
highlights[4].id
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
context('when type:highlights is in the query', () => {
|
||||
|
||||
Reference in New Issue
Block a user