aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/utils/util.spec.ts
blob: 4b39764f5871bdf4b8a9bbbf618677e3d6c706fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import {Utils} from "./utils";
import {TestBed} from "@angular/core/testing";
import each from "jest-each";


describe('Util', () => {
  let util: Utils;

  beforeAll(done => (async () => {
    TestBed.configureTestingModule({

    });
    await TestBed.compileComponents();

    util = new Utils();

  })().then(done).catch(done.fail));

  test('should be defined', () => {
    expect(util).toBeDefined();
  });

  test('hasContents should return false if object is undefined or null or empty', () => {
    expect(Utils.hasContents(undefined)).toBeFalsy();
    expect(Utils.hasContents(null)).toBeFalsy();
    expect(Utils.hasContents("")).toBeFalsy();
  });

  test('hasContents should return true if object is not undefined and not null and not empty', () => {
    expect(Utils.hasContents("someValue")).toBeTruthy();
  });

  const instantiationTypesDataProvider = [
    ['Macro', false ],
    ['ALaCarte', true ],
    ['ClientConfig', true],
    ['dont know', true]
  ];
  each(instantiationTypesDataProvider).test('instantiationType %s isALaCarte shall be %s', (instantiationType, expected ) => {
    expect(Utils.isALaCarte(instantiationType)).toEqual(expected);
  });

});