From: Jane Sandberg Date: Tue, 25 Apr 2023 13:23:30 +0000 (-0700) Subject: LP2000482: Get tests passing X-Git-Url: http://git.equinoxoli.org/?p=evergreen-equinox.git;a=commitdiff_plain;h=c1fcbda53d2d2a7858464fb8ca808e814cb7bcdf LP2000482: Get tests passing * Update karma config * Update Patron Barcode Validator directive due to a breaking change in rxjs single() * Update test assertion to match new ar-JO localization Signed-off-by: Jane Sandberg Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/eg2/angular.json b/Open-ILS/src/eg2/angular.json index 349580f..53c6a0e 100644 --- a/Open-ILS/src/eg2/angular.json +++ b/Open-ILS/src/eg2/angular.json @@ -90,9 +90,8 @@ "test": { "builder": "@angular-devkit/build-angular:karma", "options": { - "main": "src/test.ts", "karmaConfig": "./karma.conf.js", - "polyfills": "src/polyfills.ts", + "polyfills": ["zone.js", "zone.js/testing", "src/polyfills.ts"], "tsConfig": "src/tsconfig.spec.json", "scripts": [], "styles": [ diff --git a/Open-ILS/src/eg2/src/app/core/format.spec.ts b/Open-ILS/src/eg2/src/app/core/format.spec.ts index 40cbb29..f254397 100644 --- a/Open-ILS/src/eg2/src/app/core/format.spec.ts +++ b/Open-ILS/src/eg2/src/app/core/format.spec.ts @@ -132,7 +132,7 @@ describe('FormatService', () => { it('should transform long Angular format strings to a valid MomentJS one using Angular locale ar-JO', () => { registerLocaleData(localeArJO); const momentVersion = service['makeFormatParseable']('long', 'ar-JO'); - expect(momentVersion).toBe('D MMMM Y h:mm:ss a [GMT]Z'); + expect(momentVersion).toBe('D MMMM Y في h:mm:ss a [GMT]Z'); }); it('can create a valid Momentjs object given a valid datetime string and correct format', () => { const moment = service['momentize']('7/3/12, 6:06 PM', 'M/D/YY, h:mm a', 'Africa/Addis_Ababa', false); diff --git a/Open-ILS/src/eg2/src/app/share/validators/patron_barcode_validator.directive.ts b/Open-ILS/src/eg2/src/app/share/validators/patron_barcode_validator.directive.ts index 0910bf3..6df8251 100644 --- a/Open-ILS/src/eg2/src/app/share/validators/patron_barcode_validator.directive.ts +++ b/Open-ILS/src/eg2/src/app/share/validators/patron_barcode_validator.directive.ts @@ -1,8 +1,8 @@ import { Directive, forwardRef } from '@angular/core'; -import { NG_VALIDATORS, NG_ASYNC_VALIDATORS, AbstractControl, ValidationErrors, AsyncValidator, FormControl } from '@angular/forms'; +import { NG_ASYNC_VALIDATORS, AsyncValidator, FormControl } from '@angular/forms'; import {NetService} from '@eg/core/net.service'; import {AuthService} from '@eg/core/auth.service'; -import {EmptyError, Observable, of} from 'rxjs'; +import {EmptyError, Observable, SequenceError, of} from 'rxjs'; import {single, switchMap, catchError} from 'rxjs/operators'; import {Injectable} from '@angular/core'; @@ -29,7 +29,7 @@ export class PatronBarcodeValidator implements AsyncValidator { catchError((err) => { if (err instanceof EmptyError) { return of({ patronBarcode: 'No patron found with that barcode' }); - } else if ('Sequence contains more than one element' === err) { + } else if (err instanceof SequenceError) { return of({ patronBarcode: 'Barcode matches more than one patron' }); } })); diff --git a/Open-ILS/src/eg2/src/test.ts b/Open-ILS/src/eg2/src/test.ts index cd612ee..f0eaf33 100644 --- a/Open-ILS/src/eg2/src/test.ts +++ b/Open-ILS/src/eg2/src/test.ts @@ -24,9 +24,5 @@ getTestBed().initTestEnvironment( BrowserDynamicTestingModule, platformBrowserDynamicTesting() ); -// Then we find all the tests. -const context = require.context('./', true, /\.spec\.ts$/); -// And load the modules. -context.keys().map(context); // Finally, start Karma to run the tests. __karma__.start();