Merge "add FLAG_2002_VFM_UPGRADE_ADDITIONAL_OPTIONS"
[vid.git] / vid-webpack-master / src / app / shared / utils / util.spec.ts
1 import {Utils} from "./utils";
2 import {TestBed} from "@angular/core/testing";
3 import each from "jest-each";
4
5
6 describe('Util', () => {
7   let util: Utils;
8
9   beforeAll(done => (async () => {
10     TestBed.configureTestingModule({
11
12     });
13     await TestBed.compileComponents();
14
15     util = new Utils();
16
17   })().then(done).catch(done.fail));
18
19   test('should be defined', () => {
20     expect(util).toBeDefined();
21   });
22
23   test('hasContents should return false if object is undefined or null or empty', () => {
24     expect(Utils.hasContents(undefined)).toBeFalsy();
25     expect(Utils.hasContents(null)).toBeFalsy();
26     expect(Utils.hasContents("")).toBeFalsy();
27   });
28
29   test('hasContents should return true if object is not undefined and not null and not empty', () => {
30     expect(Utils.hasContents("someValue")).toBeTruthy();
31   });
32
33   const instantiationTypesDataProvider = [
34     ['Macro', false ],
35     ['ALaCarte', true ],
36     ['ClientConfig', true],
37     ['dont know', true]
38   ];
39   each(instantiationTypesDataProvider).test('instantiationType %s isALaCarte shall be %s', (instantiationType, expected ) => {
40     expect(Utils.isALaCarte(instantiationType)).toEqual(expected);
41   });
42
43 });