]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/eg2/src/app/staff/booking/reservation-actions.spec.ts
LP2045292 Color contrast for AngularJS patron bills
[working/Evergreen.git] / Open-ILS / src / eg2 / src / app / staff / booking / reservation-actions.spec.ts
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>;
11     let pcrudServiceStub: Partial<PcrudService>;
12     const routerSpy = {
13         navigate: jasmine.createSpy('navigate')
14     };
15     beforeEach(() => {
16         pcrudServiceStub = {};
17         cookieServiceStub = {};
18         pcrudServiceStub = {};
19         cookieServiceStub = {};
20         printServiceStub = {};
21         TestBed.configureTestingModule({
22             providers: [
23                 ReservationActionsService,
24                 { provide: Router, useValue: routerSpy },
25                 { provide: PcrudService, useValue: pcrudServiceStub },
26                 { provide: CookieService, useValue: cookieServiceStub },
27                 { provide: PrintService, useValue: printServiceStub }
28             ]
29         });
30         service = TestBed.get(ReservationActionsService);
31     });
32     it('can open the manage by barcode route', () => {
33         service.manageReservationsByResource('barcode123');
34         expect(routerSpy.navigate).toHaveBeenCalledWith(
35             ['/staff', 'booking', 'manage_reservations', 'by_resource', 'barcode123']);
36     });
37     it('recognizes 3 as one unique value', () => {
38         expect(service.notOneUniqueSelected([3])).toBe(false);
39     });
40     it('recognizes 1 1 as one unique value', () => {
41         expect(service.notOneUniqueSelected([1, 1])).toBe(false);
42     });
43     it('recognizes 2 3 as more than one unique value', () => {
44         expect(service.notOneUniqueSelected([2, 3])).toBe(true);
45     });
46 });