Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame] | 1 | import {Utils} from "./utils"; |
| 2 | import {TestBed} from "@angular/core/testing"; |
| 3 | |
| 4 | |
| 5 | describe('Util', () => { |
| 6 | let util: Utils; |
| 7 | |
| 8 | beforeAll(done => (async () => { |
| 9 | TestBed.configureTestingModule({ |
| 10 | |
| 11 | }); |
| 12 | await TestBed.compileComponents(); |
| 13 | |
| 14 | util = new Utils(); |
| 15 | |
| 16 | })().then(done).catch(done.fail)); |
| 17 | |
| 18 | test('should be defined', () => { |
| 19 | expect(util).toBeDefined(); |
| 20 | }); |
| 21 | |
| 22 | test('hasContents should return false if object is undefined or null or empty', () => { |
| 23 | expect(Utils.hasContents(undefined)).toBeFalsy(); |
| 24 | expect(Utils.hasContents(null)).toBeFalsy(); |
| 25 | expect(Utils.hasContents("")).toBeFalsy(); |
| 26 | }); |
| 27 | |
| 28 | test('hasContents should return true if object is not undefined and not null and not empty', () => { |
| 29 | expect(Utils.hasContents("someValue")).toBeTruthy(); |
| 30 | }); |
| 31 | }); |