summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/utils/log/log.service.spec.ts
diff options
context:
space:
mode:
Diffstat (limited to 'vid-webpack-master/src/app/shared/utils/log/log.service.spec.ts')
-rw-r--r--vid-webpack-master/src/app/shared/utils/log/log.service.spec.ts46
1 files changed, 42 insertions, 4 deletions
diff --git a/vid-webpack-master/src/app/shared/utils/log/log.service.spec.ts b/vid-webpack-master/src/app/shared/utils/log/log.service.spec.ts
index ea0eb0499..15a840f76 100644
--- a/vid-webpack-master/src/app/shared/utils/log/log.service.spec.ts
+++ b/vid-webpack-master/src/app/shared/utils/log/log.service.spec.ts
@@ -1,16 +1,24 @@
import {LogService} from "./log.service";
+import {TestBed} from "@angular/core/testing";
describe('log service service', () => {
+
let logService : LogService;
- beforeEach(() => {
+ beforeAll(done => (async () => {
+ TestBed.configureTestingModule({
+
+ });
+ await TestBed.compileComponents();
logService = new LogService();
- });
- it('check all ILogger function are defined', ()=>{
+ })().then(done).catch(done.fail));
+
+
+ test('check all ILogger function are defined', ()=>{
expect(logService.log).toBeDefined();
expect(logService.assert).toBeDefined();
expect(logService.error).toBeDefined();
@@ -20,10 +28,40 @@ describe('log service service', () => {
expect(logService.warn).toBeDefined();
});
- it('test getPrefixLog function', ()=> {
+ test('test getPrefixLog function: with data', ()=> {
let args = ['message', [1,2,3,4,5]];
let result = LogService.getPrefixLog(args);
expect(result).toBeDefined();
});
+ test('log assert', ()=> {
+ jest.spyOn(console, 'assert');
+ logService.assert('someArg');
+ expect(console.assert).toHaveBeenCalled();
+ });
+
+ test('log group', ()=> {
+ jest.spyOn(console, 'group');
+ logService.group('someArg');
+ expect(console.group).toHaveBeenCalled();
+ });
+
+ test('log groupEnd', ()=> {
+ jest.spyOn(console, 'groupEnd');
+ logService.groupEnd('someArg');
+ expect(console.groupEnd).toHaveBeenCalled();
+ });
+
+ test('log log', ()=> {
+ jest.spyOn(console, 'log');
+ logService.log('someArg');
+ expect(console.log).toHaveBeenCalled();
+ });
+
+ test('log warn', ()=> {
+ spyOn(console, 'warn');
+ logService.warn('someArg');
+ expect(console.warn).toHaveBeenCalled();
+ });
+
});