Select Git revision
validation.py
-
Thorge Petersen authored
# Conflicts: # CHANGELOG.md
Thorge Petersen authored# Conflicts: # CHANGELOG.md
build-info.component.spec.ts 3.64 KiB
/*
* Copyright (C) 2022 Das Land Schleswig-Holstein vertreten durch den
* Ministerpräsidenten des Landes Schleswig-Holstein
* Staatskanzlei
* Abteilung Digitalisierung und zentrales IT-Management der Landesregierung
*
* Lizenziert unter der EUPL, Version 1.2 oder - sobald
* diese von der Europäischen Kommission genehmigt wurden -
* Folgeversionen der EUPL ("Lizenz");
* Sie dürfen dieses Werk ausschließlich gemäß
* dieser Lizenz nutzen.
* Eine Kopie der Lizenz finden Sie hier:
*
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
*
* Sofern nicht durch anwendbare Rechtsvorschriften
* gefordert oder in schriftlicher Form vereinbart, wird
* die unter der Lizenz verbreitete Software "so wie sie
* ist", OHNE JEGLICHE GEWÄHRLEISTUNG ODER BEDINGUNGEN -
* ausdrücklich oder stillschweigend - verbreitet.
* Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
import { FormatDateWithTimePipe } from '@alfa-client/tech-shared';
import { registerLocaleData } from '@angular/common';
import localeDe from '@angular/common/locales/de';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { createApiRootResource } from 'libs/api-root-shared/test/api-root';
import { BuildInfoComponent } from './build-info.component';
import * as DateUtil from '@alfa-client/tech-shared';
registerLocaleData(localeDe);
jest.mock('@alfa-client/tech-shared', () => mockAsEsModule('@alfa-client/tech-shared'));
function mockAsEsModule(module: string) {
return {
__esModule: true,
...jest.requireActual(module),
};
}
describe('BuildInfoComponent', () => {
let component: BuildInfoComponent;
let fixture: ComponentFixture<BuildInfoComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [BuildInfoComponent],
declarations: [FormatDateWithTimePipe],
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(BuildInfoComponent);
component = fixture.componentInstance;
component.apiRoot = createApiRootResource();
fixture.detectChanges();
});
it('should create', () => {
fixture.detectChanges();
expect(component).toBeTruthy();
});
describe('isNotProduction', () => {
it('should return true at non-production environment', () => {
component.apiRoot.production = false;
expect(component.isNotProduction).toBeTruthy();
});
it('should return false at production environment', () => {
component.apiRoot.production = true;
expect(component.isNotProduction).toBeFalsy();
});
});
describe('isProduction', () => {
it('should return false at non-production environment', () => {
component.apiRoot.production = false;
expect(component.isProduction).toBeFalsy();
});
it('should return true at production environment', () => {
component.apiRoot.production = true;
expect(component.isProduction).toBeTruthy();
});
});
describe('version', () => {
it('should return version fragment', () => {
component.apiRoot.version = '1.12.0-SNAPSHOT';
expect(component.version).toBe('1.12.0-SNAPSHOT');
});
});
describe('buildDate', () => {
it('should call formatFullDate', () => {
const formatFullDate = jest.spyOn(DateUtil, 'formatFullDate');
component.buildDate;
expect(formatFullDate).toHaveBeenCalled();
});
});
describe('buildTime', () => {
it('should call formatHourMinute', () => {
const formatHourMinute = jest.spyOn(DateUtil, 'formatHourMinute');
component.buildTime;
expect(formatHourMinute).toHaveBeenCalled();
});
});
});