1 import { TestBed } from '@angular/core/testing';
2 import { Router } from '@angular/router';
3 import { PcrudService } from '@eg/core/pcrud.service';
4 import { ReservationActionsService } from './reservation-actions.service';
5 describe('ReservationActionsService', () => {
6 let service: ReservationActionsService;
8 navigate: jasmine.createSpy('navigate')
11 const pcrudServiceStub = {};
12 TestBed.configureTestingModule({
14 ReservationActionsService,
15 { provide: Router, useValue: routerSpy },
16 { provide: PcrudService, useValue: pcrudServiceStub }
19 service = TestBed.get(ReservationActionsService);
21 it('can open the manage by barcode route', () => {
22 service.manageReservationsByResource('barcode123');
23 expect(routerSpy.navigate).toHaveBeenCalledWith(
24 ['/staff', 'booking', 'manage_reservations', 'by_resource', 'barcode123']);
26 it('recognizes 3 as one unique value', () => {
27 expect(service.notOneUniqueSelected([3])).toBe(false);
29 it('recognizes 1 1 as one unique value', () => {
30 expect(service.notOneUniqueSelected([1, 1])).toBe(false);
32 it('recognizes 2 3 as more than one unique value', () => {
33 expect(service.notOneUniqueSelected([2, 3])).toBe(true);