Skip to content

Commit

Permalink
test: add more test
Browse files Browse the repository at this point in the history
  • Loading branch information
DanSnow committed Apr 16, 2024
1 parent 66d1db1 commit 8ceef95
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,27 @@ it('can check subscribe status', async () => {
pass: true,
})
})

it('can return error', async () => {
server.use(
graphql.query('SubscriberProfile', () => {
return HttpResponse.json({
data: {
subscriberProfile: null,
},
})
}),
)

await expect(
isViewable({ meta: {} as any, auth: { token: 'token' }, getArticle: (() => {}) as any }),
).resolves.toEqual({
pass: false,
message: 'Auth fail',
})

await expect(isViewable({ meta: {} as any, auth: { token: '' }, getArticle: (() => {}) as any })).resolves.toEqual({
pass: false,
message: 'Missing token',
})
})

0 comments on commit 8ceef95

Please sign in to comment.