Browse Source

fix tests

pull/17706/head
Sinan997 3 years ago
parent
commit
82a1f302b2
  1. 2
      npm/ng-packs/packages/theme-shared/extensions/src/tests/entity-actions.spec.ts
  2. 4
      npm/ng-packs/packages/theme-shared/extensions/src/tests/entity-props.spec.ts
  3. 6
      npm/ng-packs/packages/theme-shared/extensions/src/tests/form-props.spec.ts
  4. 11
      npm/ng-packs/packages/theme-shared/extensions/src/tests/localization.util.spec.ts

2
npm/ng-packs/packages/theme-shared/extensions/src/tests/entity-actions.spec.ts

@ -107,7 +107,7 @@ describe('EntityAction', () => {
expect(action.text).toBe(options.text); expect(action.text).toBe(options.text);
expect(action.action).toBe(options.action); expect(action.action).toBe(options.action);
expect(action.permission).toBeUndefined(); expect(action.permission).toBe('');
expect(action.visible(null)).toBe(true); expect(action.visible(null)).toBe(true);
expect(action.icon).toBe(''); expect(action.icon).toBe('');
}); });

4
npm/ng-packs/packages/theme-shared/extensions/src/tests/entity-props.spec.ts

@ -111,13 +111,11 @@ describe('EntityProp', () => {
type: ePropType.String, type: ePropType.String,
name: 'NAME', name: 'NAME',
}; };
const prop = new EntityProp(options); const prop = new EntityProp(options);
expect(prop.type).toBe(options.type); expect(prop.type).toBe(options.type);
expect(prop.name).toBe(options.name); expect(prop.name).toBe(options.name);
expect(prop.displayName).toBe(options.name); expect(prop.displayName).toBe(options.name);
expect(prop.permission).toBeUndefined(); expect(prop.permission).toBe('');
expect(prop.visible()).toBe(true); expect(prop.visible()).toBe(true);
expect(prop.sortable).toBe(false); expect(prop.sortable).toBe(false);
expect(prop.columnWidth).toBeUndefined(); expect(prop.columnWidth).toBeUndefined();

6
npm/ng-packs/packages/theme-shared/extensions/src/tests/form-props.spec.ts

@ -127,14 +127,14 @@ describe('FormProp', () => {
expect(prop.type).toBe(options.type); expect(prop.type).toBe(options.type);
expect(prop.name).toBe(options.name); expect(prop.name).toBe(options.name);
expect(prop.displayName).toBe(options.name); expect(prop.displayName).toBe(options.name);
expect(prop.permission).toBeUndefined(); expect(prop.permission).toBe('');
expect(prop.visible()).toBe(true); expect(prop.visible()).toBe(true);
expect(prop.asyncValidators(null)).toEqual([]); expect(prop.asyncValidators(null)).toEqual([]);
expect(prop.validators(null)).toEqual([]); expect(prop.validators(null)).toEqual([]);
expect(prop.disabled()).toBe(false); expect(prop.disabled()).toBe(false);
expect(prop.readonly()).toBe(false); expect(prop.readonly()).toBe(false);
expect(prop.autocomplete).toBe('off'); expect(prop.autocomplete).toBe('off');
expect(prop.defaultValue).toBeNull(); expect(prop.defaultValue).toBe('');
expect(prop.options).toBeUndefined(); expect(prop.options).toBeUndefined();
expect(prop.id).toBe(options.name); expect(prop.id).toBe(options.name);
}); });
@ -144,7 +144,7 @@ describe('FormProp', () => {
${0} | ${0} ${0} | ${0}
${''} | ${''} ${''} | ${''}
${false} | ${false} ${false} | ${false}
${undefined} | ${null} ${undefined} | ${''}
`( `(
'should set defaultValue as $expected when $defaultValue is given', 'should set defaultValue as $expected when $defaultValue is given',
({ defaultValue, expected }) => { ({ defaultValue, expected }) => {

11
npm/ng-packs/packages/theme-shared/extensions/src/tests/localization.util.spec.ts

@ -3,17 +3,20 @@ import { createDisplayNameLocalizationPipeKeyGenerator } from '../lib/utils/loca
describe('Localization Utils', () => { describe('Localization Utils', () => {
describe('#createDisplayNameLocalizationPipeKeyGenerator', () => { describe('#createDisplayNameLocalizationPipeKeyGenerator', () => {
const generateDisplayName = createDisplayNameLocalizationPipeKeyGenerator({ const localization: ApplicationLocalizationConfigurationDto = {
values: { values:{
Foo: { Bar: 'Bar', 'DisplayName:Bar': 'Bar' }, Foo: { Bar: 'Bar', 'DisplayName:Bar': 'Bar' },
Default: { Bar: 'Bar', 'DisplayName:Bar': 'Bar' }, Default: { Bar: 'Bar', 'DisplayName:Bar': 'Bar' },
}, },
defaultResourceName: 'Default', defaultResourceName: 'Default',
currentCulture: null, resources: {},
languages: [], languages: [],
languageFilesMap: null, languageFilesMap: null,
languagesMap: null, languagesMap: null,
} as ApplicationLocalizationConfigurationDto); currentCulture: null
}
const generateDisplayName = createDisplayNameLocalizationPipeKeyGenerator(localization);
test.each` test.each`
displayName | fallback | expected displayName | fallback | expected

Loading…
Cancel
Save