Merge pull request #2650 from JaySoni1/opq

Resolve Jest Error Before Proceeding With Codecov
This commit is contained in:
Gopi Kishan
2025-09-26 18:11:37 +05:30
committed by GitHub
12 changed files with 1 additions and 903 deletions
-7
View File
@@ -1,7 +0,0 @@
describe('My First Test', () => {
it('Visits the initial project page', () => {
cy.visit('/');
cy.contains('Welcome');
cy.contains('sandbox app is running!');
});
});
+1 -1
View File
@@ -1,4 +1,4 @@
/**
/**
* For a detailed explanation regarding each configuration property, visit:
* https://jestjs.io/docs/configuration
*/
@@ -1,55 +0,0 @@
// import { TestBed, inject } from '@angular/core/testing';
// import { Router } from '@angular/router';
// import { AuthenticationService } from './authentication.service';
// import { MockAuthenticationService } from './authentication.service.mock';
// import { AuthenticationGuard } from './authentication.guard';
// describe('AuthenticationGuard', () => {
// let authenticationGuard: AuthenticationGuard;
// let authenticationService: MockAuthenticationService;
// let mockRouter: any;
// beforeEach(() => {
// mockRouter = {
// navigate: jasmine.createSpy('navigate')
// };
// TestBed.configureTestingModule({
// providers: [
// AuthenticationGuard,
// { provide: AuthenticationService, useClass: MockAuthenticationService },
// { provide: Router, useValue: mockRouter },
// ]
// });
// });
// beforeEach(inject([
// AuthenticationGuard,
// AuthenticationService
// ], (_authenticationGuard: AuthenticationGuard,
// _authenticationService: MockAuthenticationService) => {
// authenticationGuard = _authenticationGuard;
// authenticationService = _authenticationService;
// }));
// it('should have a canActivate method', () => {
// expect(typeof authenticationGuard.canActivate).toBe('function');
// });
// it('should return true if user is authenticated', () => {
// expect(authenticationGuard.canActivate()).toBe(true);
// });
// it('should return false and redirect to login if user is not authenticated', () => {
// // Arrange
// authenticationService.credentials = null;
// // Act
// const result = authenticationGuard.canActivate();
// // Assert
// expect(mockRouter.navigate).toHaveBeenCalledWith(['/login'], {replaceUrl: true});
// expect(result).toBe(false);
// });
// });
@@ -1,148 +0,0 @@
// import { TestBed, inject, fakeAsync, tick } from '@angular/core/testing';
// import { AuthenticationService } from './authentication.service';
// const credentialsStorageKey = 'mifosXCredentials';
// describe('AuthenticationService', () => {
// let authenticationService: AuthenticationService;
// beforeEach(() => {
// TestBed.configureTestingModule({
// providers: [AuthenticationService]
// });
// });
// beforeEach(inject([
// AuthenticationService
// ], (_authenticationService: AuthenticationService) => {
// authenticationService = _authenticationService;
// }));
// afterEach(() => {
// // Cleanup
// localStorage.removeItem(credentialsStorageKey);
// sessionStorage.removeItem(credentialsStorageKey);
// });
// describe('login', () => {
// it('should return credentials', fakeAsync(() => {
// // Act
// const request = authenticationService.login({
// username: 'mifos',
// password: 'password',
// remember: false
// });
// tick();
// // Assert
// request.subscribe(credentials => {
// expect(credentials).toBeDefined();
// // expect(credentials.token).toBeDefined();
// });
// }));
// it('should authenticate user', fakeAsync(() => {
// expect(authenticationService.isAuthenticated()).toBe(false);
// // Act
// const request = authenticationService.login({
// username: 'mifos',
// password: 'password',
// remember: false
// });
// tick();
// // Assert
// request.subscribe(() => {
// expect(authenticationService.isAuthenticated()).toBe(true);
// // expect(authenticationService.credentials).toBeDefined();
// // expect(authenticationService.credentials).not.toBeNull();
// // expect((<Credentials>authenticationService.credentials).token).toBeDefined();
// // expect((<Credentials>authenticationService.credentials).token).not.toBeNull();
// });
// }));
// it('should persist credentials for the session', fakeAsync(() => {
// // Act
// const request = authenticationService.login({
// username: 'mifos',
// password: 'password',
// remember: false
// });
// tick();
// // Assert
// request.subscribe(() => {
// expect(sessionStorage.getItem(credentialsStorageKey)).not.toBeNull();
// });
// }));
// it('should persist credentials across sessions', fakeAsync(() => {
// // Act
// const request = authenticationService.login({
// username: 'mifos',
// password: 'password',
// remember: true
// });
// tick();
// // Assert
// request.subscribe(() => {
// expect(localStorage.getItem(credentialsStorageKey)).not.toBeNull();
// });
// }));
// });
// describe('logout', () => {
// it('should clear user authentication', fakeAsync(() => {
// // Arrange
// const loginRequest = authenticationService.login({
// username: 'mifos',
// password: 'password',
// remember: false
// });
// tick();
// // Assert
// loginRequest.subscribe(() => {
// expect(authenticationService.isAuthenticated()).toBe(true);
// const request = authenticationService.logout();
// tick();
// request.subscribe(() => {
// expect(authenticationService.isAuthenticated()).toBe(false);
// // expect(authenticationService.credentials).toBeNull();
// expect(sessionStorage.getItem(credentialsStorageKey)).toBeNull();
// expect(localStorage.getItem(credentialsStorageKey)).toBeNull();
// });
// });
// }));
// it('should clear persisted user authentication', fakeAsync(() => {
// // Arrange
// const loginRequest = authenticationService.login({
// username: 'mifos',
// password: 'password',
// remember: true
// });
// tick();
// // Assert
// loginRequest.subscribe(() => {
// expect(authenticationService.isAuthenticated()).toBe(true);
// const request = authenticationService.logout();
// tick();
// request.subscribe(() => {
// expect(authenticationService.isAuthenticated()).toBe(false);
// // expect(authenticationService.credentials).toBeNull();
// expect(sessionStorage.getItem(credentialsStorageKey)).toBeNull();
// expect(localStorage.getItem(credentialsStorageKey)).toBeNull();
// });
// });
// }));
// });
// });
@@ -1,44 +0,0 @@
// import { TestBed, inject } from '@angular/core/testing';
// import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
// import { HTTP_INTERCEPTORS, HttpClient } from '@angular/common/http';
// import { environment } from '../../../environments/environment';
// import { ApiPrefixInterceptor } from './api-prefix.interceptor';
// describe('ApiPrefixInterceptor', () => {
// let http: HttpClient;
// let httpMock: HttpTestingController;
// beforeEach(() => {
// TestBed.configureTestingModule({
// imports: [HttpClientTestingModule],
// providers: [{
// provide: HTTP_INTERCEPTORS,
// useClass: ApiPrefixInterceptor,
// multi: true
// }]
// });
// });
// beforeEach(inject([
// HttpClient,
// HttpTestingController
// ], (_http: HttpClient,
// _httpMock: HttpTestingController) => {
// http = _http;
// httpMock = _httpMock;
// }));
// afterEach(() => {
// httpMock.verify();
// });
// it('should prepend environment.serverUrl to the request url', () => {
// // Act
// http.get('/toto').subscribe();
// // Assert
// httpMock.expectOne({ url: environment.serverUrl + '/toto' });
// });
// });
-135
View File
@@ -1,135 +0,0 @@
// import { TestBed, inject } from '@angular/core/testing';
// import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
// import { HTTP_INTERCEPTORS, HttpClient, HttpResponse } from '@angular/common/http';
// import { CacheInterceptor } from './cache.interceptor';
// import { HttpCacheService } from './http-cache.service';
// describe('CacheInterceptor', () => {
// let interceptorOptions: Object | null = {};
// let httpCacheService: HttpCacheService;
// let cacheInterceptor: CacheInterceptor;
// let http: HttpClient;
// let httpMock: HttpTestingController;
// function createInterceptor(_httpCacheService: HttpCacheService) {
// cacheInterceptor = new CacheInterceptor(_httpCacheService).configure(interceptorOptions);
// return cacheInterceptor;
// }
// beforeEach(() => {
// TestBed.configureTestingModule({
// imports: [HttpClientTestingModule],
// providers: [
// HttpCacheService,
// {
// provide: HTTP_INTERCEPTORS,
// useFactory: createInterceptor,
// deps: [HttpCacheService],
// multi: true
// }
// ]
// });
// });
// afterEach(() => {
// httpCacheService.cleanCache();
// httpMock.verify();
// });
// describe('with default configuration', () => {
// beforeEach(() => {
// interceptorOptions = null;
// });
// beforeEach(inject([
// HttpClient,
// HttpTestingController,
// HttpCacheService
// ], (_http: HttpClient,
// _httpMock: HttpTestingController,
// _httpCacheService: HttpCacheService) => {
// http = _http;
// httpMock = _httpMock;
// httpCacheService = _httpCacheService;
// }));
// it('should cache the request', () => {
// // Act
// http.get('/toto').subscribe(() => {
// // Assert
// const cachedData = httpCacheService.getCacheData('/toto');
// expect(cachedData).toBeDefined();
// expect(cachedData ? cachedData.body : null).toEqual('someData');
// });
// httpMock.expectOne({ url: '/toto' }).flush('someData');
// });
// it('should respond from the cache', () => {
// // Arrange
// httpCacheService.setCacheData('/toto', new HttpResponse({ body: 'cachedData' }));
// // Act
// http.get('/toto').subscribe(response => {
// // Assert
// expect(response).toEqual('cachedData');
// });
// httpMock.expectNone({ url: '/toto' });
// });
// it('should not cache the request in case of error', () => {
// // Act
// http.get('/toto').subscribe(() => {}, () => {
// // Assert
// expect(httpCacheService.getCacheData('/toto')).toBeNull();
// });
// httpMock.expectOne({}).flush(null, {
// status: 404,
// statusText: 'error'
// });
// });
// });
// describe('with update forced configuration', () => {
// beforeEach(() => {
// interceptorOptions = { update: true };
// });
// beforeEach(inject([
// HttpClient,
// HttpTestingController,
// HttpCacheService
// ], (_http: HttpClient,
// _httpMock: HttpTestingController,
// _httpCacheService: HttpCacheService) => {
// http = _http;
// httpMock = _httpMock;
// httpCacheService = _httpCacheService;
// }));
// afterEach(() => {
// httpCacheService.cleanCache();
// httpMock.verify();
// });
// it('should force cache update', () => {
// // Arrange
// httpCacheService.setCacheData('/toto', new HttpResponse({ body: 'oldCachedData' }));
// cacheInterceptor.configure({ update: true });
// // Act
// http.get('/toto').subscribe(response => {
// // Assert
// expect(response).toEqual('newData');
// });
// httpMock.expectOne({ url: '/toto' }).flush('newData');
// });
// });
// });
@@ -1,59 +0,0 @@
// import { TestBed, inject } from '@angular/core/testing';
// import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
// import { HTTP_INTERCEPTORS, HttpClient } from '@angular/common/http';
// import { ErrorHandlerInterceptor } from './error-handler.interceptor';
// describe('ErrorHandlerInterceptor', () => {
// let errorHandlerInterceptor: ErrorHandlerInterceptor;
// let http: HttpClient;
// let httpMock: HttpTestingController;
// function createInterceptor() {
// errorHandlerInterceptor = new ErrorHandlerInterceptor();
// return errorHandlerInterceptor;
// }
// beforeEach(() => {
// TestBed.configureTestingModule({
// imports: [HttpClientTestingModule],
// providers: [{
// provide: HTTP_INTERCEPTORS,
// useFactory: createInterceptor,
// multi: true
// }]
// });
// });
// beforeEach(inject([
// HttpClient,
// HttpTestingController
// ], (_http: HttpClient,
// _httpMock: HttpTestingController) => {
// http = _http;
// httpMock = _httpMock;
// }));
// afterEach(() => {
// httpMock.verify();
// });
// it('should catch error and call error handler', () => {
// // Arrange
// // Note: here we spy on private method since target is customization here,
// // but you should replace it by actual behavior in your app
// spyOn(ErrorHandlerInterceptor.prototype as any, 'errorHandler').and.callThrough();
// // Act
// http.get('/toto').subscribe(() => fail('should error'), () => {
// // Assert
// expect(ErrorHandlerInterceptor.prototype['errorHandler']).toHaveBeenCalled();
// });
// httpMock.expectOne({}).flush(null, {
// status: 404,
// statusText: 'error'
// });
// });
// });
@@ -1,194 +0,0 @@
// import { TestBed, inject } from '@angular/core/testing';
// import { HttpResponse } from '@angular/common/http';
// import { HttpCacheService, HttpCacheEntry } from './http-cache.service';
// const cachePersistenceKey = 'httpCache';
// describe('HttpCacheService', () => {
// let httpCacheService: HttpCacheService;
// let response: HttpResponse<any>;
// beforeEach(() => {
// TestBed.configureTestingModule({
// providers: [HttpCacheService]
// });
// // Start fresh
// window.sessionStorage.removeItem(cachePersistenceKey);
// window.localStorage.removeItem(cachePersistenceKey);
// });
// beforeEach(inject([HttpCacheService], (_httpCacheService: HttpCacheService) => {
// httpCacheService = _httpCacheService;
// response = new HttpResponse({ body: 'data' });
// }));
// afterEach(() => {
// httpCacheService.cleanCache();
// });
// describe('setCacheData', () => {
// it('should set cache data', () => {
// // Act
// httpCacheService.setCacheData('/popo', response);
// // Assert
// expect(httpCacheService.getCacheData('/popo')).toEqual(response);
// });
// it('should replace existing data', () => {
// // Arrange
// const newResponse = new HttpResponse({ body: 'new data' });
// // Act
// httpCacheService.setCacheData('/popo', response);
// httpCacheService.setCacheData('/popo', newResponse);
// // Assert
// expect(httpCacheService.getCacheData('/popo')).toEqual(newResponse);
// });
// it('should set cache date correctly', () => {
// // Act
// const date = new Date(123);
// httpCacheService.setCacheData('/popo', response, date);
// httpCacheService.setCacheData('/hoho', response);
// // Assert
// expect((<HttpCacheEntry>httpCacheService.getHttpCacheEntry('/popo')).lastUpdated).toBe(date);
// expect((<HttpCacheEntry>httpCacheService.getHttpCacheEntry('/hoho')).lastUpdated).not.toBe(date);
// });
// });
// describe('getCacheData', () => {
// it('should return null if no cache', () => {
// expect(httpCacheService.getCacheData('/hoho')).toBe(null);
// });
// it('should return cached data if exists', () => {
// // Act
// httpCacheService.setCacheData('/hoho', response);
// // Assert
// expect(httpCacheService.getCacheData('/hoho')).toEqual(response);
// });
// it('should return cached data with url parameters if exists', () => {
// // Act
// httpCacheService.setCacheData('/hoho?pif=paf', response);
// // Assert
// expect(httpCacheService.getCacheData('/hoho?pif=paf')).toEqual(response);
// });
// });
// describe('getHttpCacheEntry', () => {
// it('should return null if no cache', () => {
// expect(httpCacheService.getHttpCacheEntry('/hoho')).toBe(null);
// });
// it('should return cached data date if exists', () => {
// // Arrange
// const date = new Date(123);
// // Act
// httpCacheService.setCacheData('/hoho', response, date);
// const entry = httpCacheService.getHttpCacheEntry('/hoho');
// // Assert
// expect(entry).not.toBeNull();
// expect((<HttpCacheEntry>entry).lastUpdated).toEqual(date);
// expect((<HttpCacheEntry>entry).data).toEqual(response);
// });
// });
// describe('clearCacheData', () => {
// it('should clear existing cache data', () => {
// // Set cache
// httpCacheService.setCacheData('/hoho', response);
// expect(httpCacheService.getCacheData('/hoho')).toEqual(response);
// // Clear cache
// httpCacheService.clearCache('/hoho');
// expect(httpCacheService.getCacheData('/hoho')).toBe(null);
// });
// it('should do nothing if no cache exists', () => {
// expect(httpCacheService.getCacheData('/lolo')).toBe(null);
// httpCacheService.clearCache('/hoho');
// expect(httpCacheService.getCacheData('/lolo')).toBe(null);
// });
// });
// describe('cleanCache', () => {
// it('should clear all cache if no date is specified', () => {
// // Set cache
// httpCacheService.setCacheData('/hoho', response);
// httpCacheService.setCacheData('/popo', response);
// expect(httpCacheService.getCacheData('/hoho')).toBe(response);
// expect(httpCacheService.getCacheData('/popo')).toBe(response);
// // Clean cache
// httpCacheService.cleanCache();
// expect(httpCacheService.getCacheData('/hoho')).toBe(null);
// expect(httpCacheService.getCacheData('/popo')).toBe(null);
// });
// it('should clear existing since specified date', () => {
// // Set cache
// httpCacheService.setCacheData('/hoho', response);
// expect(httpCacheService.getCacheData('/hoho')).toBe(response);
// // Clean cache
// httpCacheService.cleanCache(new Date());
// expect(httpCacheService.getCacheData('/hoho')).toBe(null);
// });
// it('should not affect cache entries newer than specified date', () => {
// // Set cache
// httpCacheService.setCacheData('/hoho', response);
// expect(httpCacheService.getCacheData('/hoho')).toBe(response);
// // Clean cache
// const date = new Date();
// httpCacheService.setCacheData('/lolo', response, new Date(date.getTime() + 10));
// httpCacheService.cleanCache(date);
// // Assert
// expect(httpCacheService.getCacheData('/hoho')).toBe(null);
// expect(httpCacheService.getCacheData('/lolo')).toBe(response);
// });
// });
// describe('setPersistence', () => {
// beforeEach(() => {
// httpCacheService.setPersistence();
// httpCacheService.cleanCache = jasmine.createSpy('cleanCache');
// });
// it('should clear previous cache data when persistence value change', () => {
// httpCacheService.setPersistence('local');
// expect(httpCacheService.cleanCache).toHaveBeenCalledWith();
// });
// it('should persist cache to local storage', () => {
// expect(localStorage.getItem(cachePersistenceKey)).toBeNull();
// httpCacheService.setPersistence('local');
// httpCacheService.setCacheData('/hoho', response);
// expect(localStorage.getItem(cachePersistenceKey)).not.toBeNull();
// });
// it('should persist cache to session storage', () => {
// expect(sessionStorage.getItem(cachePersistenceKey)).toBeNull();
// httpCacheService.setPersistence('session');
// httpCacheService.setCacheData('/hoho', response);
// expect(sessionStorage.getItem(cachePersistenceKey)).not.toBeNull();
// });
// });
// });
-140
View File
@@ -1,140 +0,0 @@
// import { TestBed, inject } from '@angular/core/testing';
// import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
// import { HttpClient, HttpInterceptor } from '@angular/common/http';
// import { HttpService } from './http.service';
// import { HttpCacheService } from './http-cache.service';
// import { ErrorHandlerInterceptor } from './error-handler.interceptor';
// import { CacheInterceptor } from './cache.interceptor';
// import { ApiPrefixInterceptor } from './api-prefix.interceptor';
// describe('HttpService', () => {
// let httpCacheService: HttpCacheService;
// let http: HttpClient;
// let httpMock: HttpTestingController;
// beforeEach(() => {
// TestBed.configureTestingModule({
// imports: [HttpClientTestingModule],
// providers: [
// ErrorHandlerInterceptor,
// CacheInterceptor,
// ApiPrefixInterceptor,
// HttpCacheService,
// {
// provide: HttpClient,
// useClass: HttpService
// },
// ]
// });
// });
// beforeEach(inject([
// HttpClient,
// HttpTestingController,
// HttpCacheService
// ], (_http: HttpClient,
// _httpMock: HttpTestingController,
// _httpCacheService: HttpCacheService) => {
// http = _http;
// httpMock = _httpMock;
// httpCacheService = _httpCacheService;
// }));
// afterEach(() => {
// httpCacheService.cleanCache();
// httpMock.verify();
// });
// it('should use error handler, API prefix and no cache by default', () => {
// // Arrange
// let interceptors: HttpInterceptor[];
// const realRequest = http.request;
// spyOn(HttpService.prototype, 'request').and.callFake(function(this: any) {
// interceptors = this.interceptors;
// return realRequest.apply(this, arguments);
// });
// // Act
// const request = http.get('/toto');
// // Assert
// request.subscribe(() => {
// expect(http.request).toHaveBeenCalled();
// expect(interceptors.some(i => i instanceof ApiPrefixInterceptor)).toBeTruthy();
// expect(interceptors.some(i => i instanceof ErrorHandlerInterceptor)).toBeTruthy();
// expect(interceptors.some(i => i instanceof CacheInterceptor)).toBeFalsy();
// });
// httpMock.expectOne({}).flush({});
// });
// it('should use cache', () => {
// // Arrange
// let interceptors: HttpInterceptor[];
// const realRequest = http.request;
// spyOn(HttpService.prototype, 'request').and.callFake(function(this: any) {
// interceptors = this.interceptors;
// return realRequest.apply(this, arguments);
// });
// // Act
// const request = http
// .cache()
// .get('/toto');
// // Assert
// request.subscribe(() => {
// expect(interceptors.some(i => i instanceof ApiPrefixInterceptor)).toBeTruthy();
// expect(interceptors.some(i => i instanceof ErrorHandlerInterceptor)).toBeTruthy();
// expect(interceptors.some(i => i instanceof CacheInterceptor)).toBeTruthy();
// });
// httpMock.expectOne({}).flush({});
// });
// it('should skip error handler', () => {
// // Arrange
// let interceptors: HttpInterceptor[];
// const realRequest = http.request;
// spyOn(HttpService.prototype, 'request').and.callFake(function(this: any) {
// interceptors = this.interceptors;
// return realRequest.apply(this, arguments);
// });
// // Act
// const request = http
// .skipErrorHandler()
// .get('/toto');
// // Assert
// request.subscribe(() => {
// expect(interceptors.some(i => i instanceof ApiPrefixInterceptor)).toBeTruthy();
// expect(interceptors.some(i => i instanceof ErrorHandlerInterceptor)).toBeFalsy();
// expect(interceptors.some(i => i instanceof CacheInterceptor)).toBeFalsy();
// });
// httpMock.expectOne({}).flush({});
// });
// it('should not use API prefix', () => {
// // Arrange
// let interceptors: HttpInterceptor[];
// const realRequest = http.request;
// spyOn(HttpService.prototype, 'request').and.callFake(function(this: any) {
// interceptors = this.interceptors;
// return realRequest.apply(this, arguments);
// });
// // Act
// const request = http
// .disableApiPrefix()
// .get('/toto');
// // Assert
// request.subscribe(() => {
// expect(interceptors.some(i => i instanceof ApiPrefixInterceptor)).toBeFalsy();
// expect(interceptors.some(i => i instanceof ErrorHandlerInterceptor)).toBeTruthy();
// expect(interceptors.some(i => i instanceof CacheInterceptor)).toBeFalsy();
// });
// httpMock.expectOne({}).flush({});
// });
// });
@@ -1,72 +0,0 @@
// import { Logger, LogLevel, LogOutput } from './logger.service';
// const logMethods = ['log', 'info', 'warn', 'error'];
// describe('Logger', () => {
// let savedConsole: Function[];
// let savedLevel: LogLevel;
// let savedOutputs: LogOutput[];
// beforeAll(() => {
// savedConsole = [];
// logMethods.forEach((m) => {
// savedConsole[m] = console[m];
// console[m] = () => {};
// });
// savedLevel = Logger.level;
// savedOutputs = Logger.outputs;
// });
// afterAll(() => {
// logMethods.forEach((m) => { console[m] = savedConsole[m]; });
// Logger.level = savedLevel;
// Logger.outputs = savedOutputs;
// });
// it('should create an instance', () => {
// expect(new Logger()).toBeTruthy();
// });
// it('should add a new LogOutput and receives log entries', () => {
// // Arrange
// const outputSpy = jasmine.createSpy('outputSpy');
// const log = new Logger('test');
// // Act
// Logger.outputs.push(outputSpy);
// log.debug('d');
// log.info('i');
// log.warn('w');
// log.error('e', { error: true });
// // Assert
// expect(outputSpy).toHaveBeenCalled();
// expect(outputSpy.calls.count()).toBe(4);
// expect(outputSpy).toHaveBeenCalledWith('test', LogLevel.Debug, 'd');
// expect(outputSpy).toHaveBeenCalledWith('test', LogLevel.Info, 'i');
// expect(outputSpy).toHaveBeenCalledWith('test', LogLevel.Warning, 'w');
// expect(outputSpy).toHaveBeenCalledWith('test', LogLevel.Error, 'e', { error: true });
// });
// it('should add a new LogOutput and receives only production log entries', () => {
// // Arrange
// const outputSpy = jasmine.createSpy('outputSpy');
// const log = new Logger('test');
// // Act
// Logger.outputs.push(outputSpy);
// Logger.enableProductionMode();
// log.debug('d');
// log.info('i');
// log.warn('w');
// log.error('e', { error: true });
// // Assert
// expect(outputSpy).toHaveBeenCalled();
// expect(outputSpy.calls.count()).toBe(2);
// expect(outputSpy).toHaveBeenCalledWith('test', LogLevel.Warning, 'w');
// expect(outputSpy).toHaveBeenCalledWith('test', LogLevel.Error, 'e', { error: true });
// });
// });
-40
View File
@@ -1,40 +0,0 @@
// import { TestBed, inject } from '@angular/core/testing';
// import { AuthenticationService } from '../authentication/authentication.service';
// import { MockAuthenticationService } from '../authentication/authentication.service.mock';
// import { AuthenticationGuard } from '../authentication/authentication.guard';
// import { ShellComponent } from './shell/shell.component';
// import { Route } from './route.service';
// describe('Route', () => {
// let route: Route;
// beforeEach(() => {
// TestBed.configureTestingModule({
// providers: [
// AuthenticationGuard,
// { provide: AuthenticationService, useClass: MockAuthenticationService },
// Route
// ]
// });
// });
// beforeEach(inject([Route], (_route: Route) => {
// route = _route;
// }));
// describe('withShell', () => {
// it('should create routes as children of shell', () => {
// // Prepare
// const testRoutes = [{ path: 'test' }];
// // Act
// const result = Route.withShell(testRoutes);
// // Assert
// expect(result.path).toBe('');
// expect(result.children).toBe(testRoutes);
// expect(result.component).toBe(ShellComponent);
// });
// });
// });
@@ -1,8 +0,0 @@
// import { HasPermissionDirective } from './has-permission.directive';
// describe('HasPermissionDirective', () => {
// it('should create an instance', () => {
// const directive = new HasPermissionDirective();
// expect(directive).toBeTruthy();
// });
// });