fix: test

This commit is contained in:
Hongbo Wu 2023-06-08 18:52:47 +08:00
parent 039f00e3b2
commit 51032d2bf1
2 changed files with 20 additions and 17 deletions

View file

@ -789,8 +789,13 @@ export const updatePages = async (
return null
}
console.log('update pages task started', body.task)
return body.task as string
if (async) {
console.log('update pages task started', body.task)
return body.task as string
}
console.log('updated pages in elastic', body.updated)
return body.updated as string
} catch (e) {
console.log('failed to update pages in elastic', e)
return null

View file

@ -1267,13 +1267,11 @@ describe('Article API', () => {
authToken
).expect(200)
expect(res.body.data.bulkAction.success).to.be.true
// Wait for the archive to finish
await setTimeout(async () => {
const pages = await graphqlRequest(searchQuery(), authToken).expect(
200
)
expect(pages.body.data.search.pageInfo.totalCount).to.eql(0)
}, 1000)
await refreshIndex()
const pages = await graphqlRequest(searchQuery(), authToken).expect(200)
expect(pages.body.data.search.pageInfo.totalCount).to.eql(0)
})
})
@ -1284,14 +1282,14 @@ describe('Article API', () => {
authToken
).expect(200)
expect(res.body.data.bulkAction.success).to.be.true
// Wait for the delete to finish
await setTimeout(async () => {
const pages = await graphqlRequest(
searchQuery('in:all'),
authToken
).expect(200)
expect(pages.body.data.search.pageInfo.totalCount).to.eql(0)
}, 1000)
await refreshIndex()
const pages = await graphqlRequest(
searchQuery('in:all'),
authToken
).expect(200)
expect(pages.body.data.search.pageInfo.totalCount).to.eql(0)
})
})
})