Browse Source

Build fix and more stable tests.

release/5.7
Sebastian 5 years ago
parent
commit
cf8a820b3d
  1. 2
      frontend/app-config/karma.coverage.conf.js
  2. 2
      frontend/app/features/content/shared/references/content-creator.component.ts
  3. 20
      frontend/app/shared/state/contents.forms.visitors.spec.ts
  4. 2
      frontend/app/shared/state/rule-simulator.state.spec.ts

2
frontend/app-config/karma.coverage.conf.js

@ -32,7 +32,7 @@ module.exports = function (config) {
/** /**
* Use a mocha style console reporter, html reporter and the code coverage reporter. * Use a mocha style console reporter, html reporter and the code coverage reporter.
*/ */
reporters: ['mocha', 'html', 'coverage-istanbul'], reporters: ['kjhtml', 'mocha', 'coverage-istanbul'],
htmlReporter: { htmlReporter: {
useCompactStyle: true, useCompactStyle: true,

2
frontend/app/features/content/shared/references/content-creator.component.ts

@ -24,7 +24,7 @@ export class ContentCreatorComponent extends ResourceOwner implements OnInit {
public initialData: any; public initialData: any;
@Input() @Input()
public schemaName: string; public schemaName?: string | null;
@Input() @Input()
public schemaIds: ReadonlyArray<string>; public schemaIds: ReadonlyArray<string>;

20
frontend/app/shared/state/contents.forms.visitors.spec.ts

@ -287,12 +287,6 @@ describe('DateTimeField', () => {
expect(FieldFormatter.format(dateField, '2017-12-12T00:00:00Z')).toBe('12/12/2017'); expect(FieldFormatter.format(dateField, '2017-12-12T00:00:00Z')).toBe('12/12/2017');
}); });
it('should format to date time', () => {
const field2 = createField({ properties: createProperties('DateTime', { editor: 'DateTime' }) });
expect(FieldFormatter.format(field2, '2017-12-12T16:00:00Z')).toBe('12/12/2017, 4:00:00 PM');
});
it('should return default from properties value', () => { it('should return default from properties value', () => {
const field2 = createField({ properties: createProperties('DateTime', { editor: 'DateTime', defaultValue: '2017-10-12T16:00:00Z' }) }); const field2 = createField({ properties: createProperties('DateTime', { editor: 'DateTime', defaultValue: '2017-10-12T16:00:00Z' }) });
@ -316,6 +310,14 @@ describe('DateTimeField', () => {
expect(FieldDefaultValue.get(field2, 'iv', now)).toEqual('2017-10-12T16:30:10Z'); expect(FieldDefaultValue.get(field2, 'iv', now)).toEqual('2017-10-12T16:30:10Z');
}); });
if (isUtc()) {
it('should format to date time', () => {
const field2 = createField({ properties: createProperties('DateTime', { editor: 'DateTime' }) });
expect(FieldFormatter.format(field2, '2017-12-12T16:00:00Z')).toBe('12/12/2017, 4:00:00 PM');
});
}
}); });
describe('GeolocationField', () => { describe('GeolocationField', () => {
@ -496,4 +498,8 @@ describe('StringField', () => {
expect(FieldDefaultValue.get(field2, 'iv')).toBeNull(); expect(FieldDefaultValue.get(field2, 'iv')).toBeNull();
}); });
}); });
function isUtc() {
return new Date().getTimezoneOffset() === 0;
}

2
frontend/app/shared/state/rule-simulator.state.spec.ts

@ -64,6 +64,8 @@ describe('RuleSimulatorState', () => {
it('should not load simulated rule events if no rule selected', () => { it('should not load simulated rule events if no rule selected', () => {
ruleSimulatorState.load().subscribe(); ruleSimulatorState.load().subscribe();
expect().nothing();
rulesService.verify(x => x.getSimulatedEvents(app, It.isAnyString()), Times.never()); rulesService.verify(x => x.getSimulatedEvents(app, It.isAnyString()), Times.never());
}); });
}); });
Loading…
Cancel
Save