"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": [
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);
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';
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' });
}
}));
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();