1 import {PatronBarcodeValidator} from './patron_barcode_validator.directive';
2 import {of} from 'rxjs';
3 import {NetService} from '@eg/core/net.service';
4 import {AuthService} from '@eg/core/auth.service';
5 import {EventService} from '@eg/core/event.service';
6 import {StoreService} from '@eg/core/store.service';
7 import {HatchService} from '@eg/core/hatch.service';
9 let netService: NetService;
10 let authService: AuthService;
11 let evtService: EventService;
12 let storeService: StoreService;
13 let hatchService: HatchService;
16 evtService = new EventService();
17 hatchService = new HatchService();
18 storeService = new StoreService(null /* CookieService */, hatchService);
19 netService = new NetService(evtService);
20 authService = new AuthService(evtService, netService, storeService);
23 describe('PatronBarcodeValidator', () => {
24 it('should not throw an error if there is exactly 1 match', () => {
25 const pbv = new PatronBarcodeValidator(authService, netService);
26 pbv['parseActorCall'](of(1))
28 expect(val).toBeNull();
31 it('should throw an error if there is more than 1 match', () => {
32 const pbv = new PatronBarcodeValidator(authService, netService);
33 pbv['parseActorCall'](of(1, 2, 3))
35 expect(val).not.toBeNull();
38 it('should throw an error if there is no match', () => {
39 const pbv = new PatronBarcodeValidator(authService, netService);
40 pbv['parseActorCall'](of())
42 expect(val).not.toBeNull();