Skip to content
This repository was archived by the owner on Nov 20, 2024. It is now read-only.

Commit 8ceef95

Browse files
committed
test: add more test
1 parent 66d1db1 commit 8ceef95

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

packages/karbon/src/runtime/app/__tests__/default-is-viewable.spec.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,27 @@ it('can check subscribe status', async () => {
2929
pass: true,
3030
})
3131
})
32+
33+
it('can return error', async () => {
34+
server.use(
35+
graphql.query('SubscriberProfile', () => {
36+
return HttpResponse.json({
37+
data: {
38+
subscriberProfile: null,
39+
},
40+
})
41+
}),
42+
)
43+
44+
await expect(
45+
isViewable({ meta: {} as any, auth: { token: 'token' }, getArticle: (() => {}) as any }),
46+
).resolves.toEqual({
47+
pass: false,
48+
message: 'Auth fail',
49+
})
50+
51+
await expect(isViewable({ meta: {} as any, auth: { token: '' }, getArticle: (() => {}) as any })).resolves.toEqual({
52+
pass: false,
53+
message: 'Missing token',
54+
})
55+
})

0 commit comments

Comments
 (0)