This commit is contained in:
Hongbo Wu
2022-06-28 10:14:15 +08:00
parent bf1faaeea4
commit 59efc5fea7
2 changed files with 14 additions and 0 deletions

View File

@ -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

View File

@ -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', () => {