1 import { TestBed } from '@angular/core/testing';
2 import { Router } from '@angular/router';
3 import { CookieService } from 'ngx-cookie';
4 import { PrintService } from '@eg/share/print/print.service';
5 import { PcrudService } from '@eg/core/pcrud.service';
6 import { ReservationActionsService } from './reservation-actions.service';
7 describe('ReservationActionsService', () => {
8 let service: ReservationActionsService;
9 let cookieServiceStub: Partial<CookieService>;
10 let printServiceStub: Partial<PrintService>;
12 navigate: jasmine.createSpy('navigate')
15 const pcrudServiceStub = {};
16 const cookieServiceStub = {};
17 TestBed.configureTestingModule({
19 ReservationActionsService,
20 { provide: Router, useValue: routerSpy },
21 { provide: PcrudService, useValue: pcrudServiceStub },
22 { provide: CookieService, useValue: cookieServiceStub },
23 { provide: PrintService, useValue: printServiceStub }
26 service = TestBed.get(ReservationActionsService);
28 it('can open the manage by barcode route', () => {
29 service.manageReservationsByResource('barcode123');
30 expect(routerSpy.navigate).toHaveBeenCalledWith(
31 ['/staff', 'booking', 'manage_reservations', 'by_resource', 'barcode123']);
33 it('recognizes 3 as one unique value', () => {
34 expect(service.notOneUniqueSelected([3])).toBe(false);
36 it('recognizes 1 1 as one unique value', () => {
37 expect(service.notOneUniqueSelected([1, 1])).toBe(false);
39 it('recognizes 2 3 as more than one unique value', () => {
40 expect(service.notOneUniqueSelected([2, 3])).toBe(true);