Skip to content

Commit 34f7334

Browse files
test corrections.
1 parent 0d7c619 commit 34f7334

File tree

2 files changed

+41
-3
lines changed

2 files changed

+41
-3
lines changed

web/src/components/shared/AppBar.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,12 @@
173173
}, 1200);
174174
};
175175
176-
watch(ordersStore.lastFetched, () => {
177-
void triggerBadgePulse();
178-
});
176+
watch(
177+
() => ordersStore.lastFetched,
178+
() => {
179+
void triggerBadgePulse();
180+
}
181+
);
179182
180183
watch(pendingOrdersCount, (newCount, oldCount) => {
181184
if (newCount === oldCount || newCount === 0) {

web/tests/components/shared/AppBar.test.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ const mockOrderService = {
2626
getOrders: vi.fn(),
2727
};
2828

29+
const mockNotificationsService = {
30+
setHandlerProvider: vi.fn(),
31+
start: vi.fn().mockResolvedValue(undefined),
32+
stop: vi.fn().mockResolvedValue(undefined),
33+
};
34+
2935
// Helper functions to generate test data with faker
3036
const generateJudge = (): PersonSearchItem => ({
3137
personId: faker.number.int(),
@@ -112,6 +118,7 @@ describe('AppBar.vue', () => {
112118
provide: {
113119
orderService: mockOrderService,
114120
judgeService: mockJudgeService,
121+
notificationsService: mockNotificationsService,
115122
},
116123
},
117124
...options,
@@ -406,6 +413,7 @@ describe('AppBar.vue', () => {
406413
provide: {
407414
orderService: undefined,
408415
judgeService: mockJudgeService,
416+
notificationsService: mockNotificationsService,
409417
},
410418
stubs: {
411419
VAppBar: false,
@@ -431,6 +439,33 @@ describe('AppBar.vue', () => {
431439
provide: {
432440
orderService: mockOrderService,
433441
judgeService: undefined,
442+
notificationsService: mockNotificationsService,
443+
},
444+
stubs: {
445+
VAppBar: false,
446+
VAppBarTitle: false,
447+
VTabs: false,
448+
VTab: false,
449+
VBtn: false,
450+
VSpacer: false,
451+
VBadge: false,
452+
VIcon: false,
453+
JudgeSelector: { template: '<div></div>' },
454+
},
455+
},
456+
});
457+
}).toThrow('Service is not available!');
458+
});
459+
460+
it('should throw error if notificationsService is not provided', () => {
461+
expect(() => {
462+
mount(AppBar, {
463+
global: {
464+
plugins: [router],
465+
provide: {
466+
orderService: mockOrderService,
467+
judgeService: mockJudgeService,
468+
notificationsService: undefined,
434469
},
435470
stubs: {
436471
VAppBar: false,

0 commit comments

Comments
 (0)