From a0590cc0db9276d6608ef4be0e8b5b7c5959fb5d Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Sat, 1 Sep 2018 01:07:03 +0200 Subject: [PATCH] Added tests for the version component. --- src/app/version/version.component.spec.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/app/version/version.component.spec.ts b/src/app/version/version.component.spec.ts index fcd0475..fb1ae45 100644 --- a/src/app/version/version.component.spec.ts +++ b/src/app/version/version.component.spec.ts @@ -1,6 +1,7 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import {async, ComponentFixture, TestBed} from '@angular/core/testing'; -import { VersionComponent } from './version.component'; +import {VersionComponent} from './version.component'; +import {environment} from '../../environments/environment'; describe('VersionComponent', () => { let component: VersionComponent; @@ -8,9 +9,9 @@ describe('VersionComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ VersionComponent ] + declarations: [VersionComponent] }) - .compileComponents(); + .compileComponents(); })); beforeEach(() => { @@ -22,4 +23,14 @@ describe('VersionComponent', () => { it('should create', () => { expect(component).toBeTruthy(); }); + + it('should contain the correct version', () => { + // when executing the test, we're always running with the dev environment + expect(component.VERSION).toEqual(`${environment.appVersion} (development build)`); + }); + + it('should have the correct value for the "production" property', () => { + // when executing the test, we're always running with the dev environment + expect(component.PROD).toBeFalsy(); + }); });