mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
[TLC-254] mock config data service, get type in form builder service+test
This commit is contained in:
@@ -897,7 +897,7 @@ describe('FormBuilderService test suite', () => {
|
||||
});
|
||||
|
||||
it(`should request the ${typeFieldProp} property and set value "dc_type"`, () => {
|
||||
service.setTypeBindFieldFromConfig();
|
||||
// This should have been called in the service constructor
|
||||
expect(configSpy.findByPropertyName).toHaveBeenCalledTimes(1);
|
||||
expect(configSpy.findByPropertyName).toHaveBeenCalledWith(typeFieldProp);
|
||||
expect(service.getTypeField()).toEqual('dc_type');
|
||||
|
@@ -74,7 +74,7 @@ export class FormBuilderService extends DynamicFormService {
|
||||
super(componentService, validationService);
|
||||
this.formModels = new Map();
|
||||
this.formGroups = new Map();
|
||||
if (hasValue(configService)) {
|
||||
if (hasValue(configService) || true) {
|
||||
this.setTypeBindFieldFromConfig();
|
||||
} else {
|
||||
this.typeField = 'dc_type';
|
||||
|
14
src/app/shared/mocks/find-id-config-data.service.mock.ts
Normal file
14
src/app/shared/mocks/find-id-config-data.service.mock.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { createSuccessfulRemoteDataObject$ } from '../remote-data.utils';
|
||||
import {ConfigurationProperty} from "../../core/shared/configuration-property.model";
|
||||
|
||||
export function getMockFindByIdDataService(propertyKey: string, ...values: string[]) {
|
||||
return jasmine.createSpyObj('findByIdDataService', {
|
||||
findByPropertyName: createSuccessfulRemoteDataObject$({
|
||||
... new ConfigurationProperty(),
|
||||
name: propertyKey,
|
||||
values: values,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user