Browse Source

Improved test stability.

pull/566/head
Sebastian 5 years ago
parent
commit
34db923daf
  1. 42
      frontend/app/framework/angular/pipes/date-time.pipes.spec.ts

42
frontend/app/framework/angular/pipes/date-time.pipes.spec.ts

@ -5,12 +5,16 @@
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/
import { DateTime, Duration } from '@app/framework/internal';
import { DateHelper, DateTime, Duration } from '@app/framework/internal';
import { DatePipe, DayOfWeekPipe, DayPipe, DurationPipe, FromNowPipe, FullDateTimePipe, ISODatePipe, MonthPipe, ShortDatePipe, ShortTimePipe } from './date-time.pipes';
const dateTime = DateTime.parseISO('2013-10-03T12:13:14.125', false);
describe('DurationPipe', () => {
beforeEach(() => {
DateHelper.setlocale(null);
});
it('should format to standard duration string', () => {
const duration = Duration.create(dateTime, dateTime.addMinutes(10).addDays(13).addSeconds(10));
@ -32,6 +36,10 @@ describe('DurationPipe', () => {
});
describe('DatePipe', () => {
beforeEach(() => {
DateHelper.setlocale(null);
});
it('should format to two digit day number and short month name and year', () => {
const pipe = new DatePipe();
@ -51,6 +59,10 @@ describe('DatePipe', () => {
});
describe('DayPipe', () => {
beforeEach(() => {
DateHelper.setlocale(null);
});
it('should format to day numbers', () => {
const pipe = new DayPipe();
@ -70,6 +82,10 @@ describe('DayPipe', () => {
});
describe('DayOfWeekPipe', () => {
beforeEach(() => {
DateHelper.setlocale(null);
});
it('should format to short week of day string', () => {
const pipe = new DayOfWeekPipe();
@ -89,6 +105,10 @@ describe('DayOfWeekPipe', () => {
});
describe('FromNowPipe', () => {
beforeEach(() => {
DateHelper.setlocale(null);
});
it('should format to from now string', () => {
const pipe = new FromNowPipe();
@ -108,6 +128,10 @@ describe('FromNowPipe', () => {
});
describe('FullDateTimePipe', () => {
beforeEach(() => {
DateHelper.setlocale(null);
});
it('should format to nice string', () => {
const pipe = new FullDateTimePipe();
@ -127,6 +151,10 @@ describe('FullDateTimePipe', () => {
});
describe('MonthPipe', () => {
beforeEach(() => {
DateHelper.setlocale(null);
});
it('should format to long month name', () => {
const pipe = new MonthPipe();
@ -146,6 +174,10 @@ describe('MonthPipe', () => {
});
describe('ShortDatePipe', () => {
beforeEach(() => {
DateHelper.setlocale(null);
});
it('should format to two digit day number and short month name', () => {
const pipe = new ShortDatePipe();
@ -165,6 +197,10 @@ describe('ShortDatePipe', () => {
});
describe('ShortTimePipe', () => {
beforeEach(() => {
DateHelper.setlocale(null);
});
it('should format to short time string', () => {
const pipe = new ShortTimePipe();
@ -184,6 +220,10 @@ describe('ShortTimePipe', () => {
});
describe('ISODatePipe', () => {
beforeEach(() => {
DateHelper.setlocale(null);
});
it('should format to short time string', () => {
const pipe = new ISODatePipe();

Loading…
Cancel
Save