debugging
All checks were successful
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 2m41s
All checks were successful
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 2m41s
This commit is contained in:
@@ -6,7 +6,7 @@ const mockSubscribeToPush = vi.fn()
|
|||||||
const mockGetPushPermissionState = vi.fn()
|
const mockGetPushPermissionState = vi.fn()
|
||||||
|
|
||||||
vi.mock('@/services/pushSubscription', () => ({
|
vi.mock('@/services/pushSubscription', () => ({
|
||||||
subscribeToPush: () => mockSubscribeToPush(),
|
subscribeToPushWithResult: () => mockSubscribeToPush(),
|
||||||
getPushPermissionState: () => mockGetPushPermissionState(),
|
getPushPermissionState: () => mockGetPushPermissionState(),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ describe('PushOptIn', () => {
|
|||||||
describe('permission already granted on mount', () => {
|
describe('permission already granted on mount', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
setupNotificationMock('granted')
|
setupNotificationMock('granted')
|
||||||
mockSubscribeToPush.mockResolvedValue(true)
|
mockSubscribeToPush.mockResolvedValue({ ok: true })
|
||||||
})
|
})
|
||||||
|
|
||||||
it('silently calls subscribeToPush without showing the banner', async () => {
|
it('silently calls subscribeToPush without showing the banner', async () => {
|
||||||
@@ -58,7 +58,7 @@ describe('PushOptIn', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('calls subscribeToPush when Enable button is clicked', async () => {
|
it('calls subscribeToPush when Enable button is clicked', async () => {
|
||||||
mockSubscribeToPush.mockResolvedValue(true)
|
mockSubscribeToPush.mockResolvedValue({ ok: true })
|
||||||
const wrapper = mount(PushOptIn)
|
const wrapper = mount(PushOptIn)
|
||||||
await flushPromises()
|
await flushPromises()
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ describe('PushOptIn', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('hides banner after Enable is clicked and subscription succeeds', async () => {
|
it('hides banner after Enable is clicked and subscription succeeds', async () => {
|
||||||
mockSubscribeToPush.mockResolvedValue(true)
|
mockSubscribeToPush.mockResolvedValue({ ok: true })
|
||||||
const wrapper = mount(PushOptIn)
|
const wrapper = mount(PushOptIn)
|
||||||
await flushPromises()
|
await flushPromises()
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ describe('PushOptIn', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('does NOT post subscription to backend when subscribeToPush returns false', async () => {
|
it('does NOT post subscription to backend when subscribeToPush returns false', async () => {
|
||||||
mockSubscribeToPush.mockResolvedValue(false)
|
mockSubscribeToPush.mockResolvedValue({ ok: false, reason: 'permission_denied' })
|
||||||
const wrapper = mount(PushOptIn)
|
const wrapper = mount(PushOptIn)
|
||||||
await flushPromises()
|
await flushPromises()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user