Skip to content

Commit 87e1327

Browse files
committed
feat(test): migrate from jest to vitest
Signed-off-by: Adam Setch <adam.setch@outlook.com>
1 parent dd783be commit 87e1327

1 file changed

Lines changed: 30 additions & 10 deletions

File tree

src/renderer/hooks/useNotifications.test.ts

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ describe('renderer/hooks/useNotifications.ts', () => {
147147
vi.spyOn(
148148
apiClient,
149149
'listNotificationsForAuthenticatedUser',
150-
).mockResolvedValue(mockNotifications as any);
150+
).mockResolvedValue(
151+
mockNotifications as ListNotificationsForAuthenticatedUserResponse,
152+
);
151153

152154
const { result } = renderHook(() => useNotifications());
153155

@@ -176,7 +178,9 @@ describe('renderer/hooks/useNotifications.ts', () => {
176178
vi.spyOn(
177179
apiClient,
178180
'listNotificationsForAuthenticatedUser',
179-
).mockResolvedValue(mockNotifications as any);
181+
).mockResolvedValue(
182+
mockNotifications as ListNotificationsForAuthenticatedUserResponse,
183+
);
180184

181185
vi.spyOn(apiClient, 'fetchNotificationDetailsForList').mockResolvedValue(
182186
new Map(),
@@ -310,7 +314,9 @@ describe('renderer/hooks/useNotifications.ts', () => {
310314
vi.spyOn(
311315
apiClient,
312316
'listNotificationsForAuthenticatedUser',
313-
).mockResolvedValue(mockNotifications as any);
317+
).mockResolvedValue(
318+
mockNotifications as ListNotificationsForAuthenticatedUserResponse,
319+
);
314320

315321
const stateWithSound = {
316322
auth: {
@@ -342,7 +348,9 @@ describe('renderer/hooks/useNotifications.ts', () => {
342348
vi.spyOn(
343349
apiClient,
344350
'listNotificationsForAuthenticatedUser',
345-
).mockResolvedValue(mockNotifications as any);
351+
).mockResolvedValue(
352+
mockNotifications as ListNotificationsForAuthenticatedUserResponse,
353+
);
346354

347355
const stateWithNotifications = {
348356
auth: {
@@ -374,7 +382,9 @@ describe('renderer/hooks/useNotifications.ts', () => {
374382
vi.spyOn(
375383
apiClient,
376384
'listNotificationsForAuthenticatedUser',
377-
).mockResolvedValue(mockNotifications as any);
385+
).mockResolvedValue(
386+
mockNotifications as ListNotificationsForAuthenticatedUserResponse,
387+
);
378388

379389
const stateWithBoth = {
380390
auth: {
@@ -532,7 +542,9 @@ describe('renderer/hooks/useNotifications.ts', () => {
532542
vi.spyOn(
533543
apiClient,
534544
'listNotificationsForAuthenticatedUser',
535-
).mockResolvedValue(mockNotifications as any);
545+
).mockResolvedValue(
546+
mockNotifications as ListNotificationsForAuthenticatedUserResponse,
547+
);
536548

537549
vi.spyOn(apiClient, 'markNotificationThreadAsRead').mockResolvedValue(
538550
undefined,
@@ -643,8 +655,12 @@ describe('renderer/hooks/useNotifications.ts', () => {
643655
];
644656

645657
vi.spyOn(apiClient, 'listNotificationsForAuthenticatedUser')
646-
.mockResolvedValueOnce(mockCloudNotifications as any)
647-
.mockResolvedValueOnce(mockEnterpriseNotifications as any);
658+
.mockResolvedValueOnce(
659+
mockCloudNotifications as ListNotificationsForAuthenticatedUserResponse,
660+
)
661+
.mockResolvedValueOnce(
662+
mockEnterpriseNotifications as ListNotificationsForAuthenticatedUserResponse,
663+
);
648664

649665
vi.spyOn(apiClient, 'markNotificationThreadAsRead').mockResolvedValue(
650666
undefined,
@@ -730,7 +746,9 @@ describe('renderer/hooks/useNotifications.ts', () => {
730746
vi.spyOn(
731747
apiClient,
732748
'listNotificationsForAuthenticatedUser',
733-
).mockResolvedValue(mockNotifications as any);
749+
).mockResolvedValue(
750+
mockNotifications as ListNotificationsForAuthenticatedUserResponse,
751+
);
734752

735753
vi.spyOn(apiClient, 'markNotificationThreadAsRead').mockResolvedValue(
736754
undefined,
@@ -1032,7 +1050,9 @@ describe('renderer/hooks/useNotifications.ts', () => {
10321050
vi.spyOn(
10331051
apiClient,
10341052
'listNotificationsForAuthenticatedUser',
1035-
).mockResolvedValue(mockNotifications as any);
1053+
).mockResolvedValue(
1054+
mockNotifications as ListNotificationsForAuthenticatedUserResponse,
1055+
);
10361056

10371057
const stateWithSingleAccount = {
10381058
auth: {

0 commit comments

Comments
 (0)