Add test for fetching profile

This commit is contained in:
Jackson Harper 2024-06-19 17:50:04 +08:00
parent e2e0774e7e
commit a19c4f26c9

View file

@ -28,6 +28,13 @@ const articleSavingRequestQuery = ({
articleSavingRequest {
id
status
user {
id
profile {
id
username
}
}
}
}
... on ArticleSavingRequestError {
@ -138,6 +145,18 @@ describe('ArticleSavingRequest API', () => {
).to.eql(ArticleSavingRequestStatus.Processing)
})
it('returns the user profile info', async () => {
const res = await graphqlRequest(
articleSavingRequestQuery({ url }),
authToken
).expect(200)
expect(
res.body.data.articleSavingRequest.articleSavingRequest.user.profile
.username
).to.eql('fakeUser')
})
it('returns the article saving request by id', async () => {
const res = await graphqlRequest(
articleSavingRequestQuery({ id }),