Skip to content
Snippets Groups Projects
Commit 7a6b378e authored by OZGCloud's avatar OZGCloud
Browse files

OZG-6720 adopt test

parent 1b8b14eb
No related branches found
No related tags found
No related merge requests found
import { AdminOrganisationsEinheitResource } from '@admin-client/admin-settings';
import { AdminOrganisationsEinheitResource, AdminOrganisationsEinheitSettings } from '@admin-client/admin-settings';
import { EMPTY_STRING, StateResource, createStateResource } from '@alfa-client/tech-shared';
import { Mock, mock, useFromMock } from '@alfa-client/test-utils';
import { FormBuilder } from '@angular/forms';
......@@ -24,6 +24,7 @@ describe('OrganisationsEinheitFormService', () => {
describe('submit', () => {
const organisationsEinheitResource: AdminOrganisationsEinheitResource = createAdminOrganisationsEinheitResource();
const organisationsEinheitSettings: AdminOrganisationsEinheitSettings = { signatur: faker.lorem.word(2) };
beforeEach(() => {
const stateResource: StateResource<AdminOrganisationsEinheitResource> = createStateResource(organisationsEinheitResource);
......@@ -32,12 +33,19 @@ describe('OrganisationsEinheitFormService', () => {
service.form.setValue({
[OrganisationsEinheitFormService.ORGANISATIONSEINHEIT_SIGNATUR_FIELD]: organisationsEinheitResource.settings.signatur,
});
service.buildPatchedOrganisationsEinheitSettings = jest.fn().mockReturnValue(organisationsEinheitSettings);
});
it('should call organisationsEinheitService patch', () => {
service.submit();
expect(organisationsEinheitService.patch).toHaveBeenCalledWith(organisationsEinheitResource.settings);
expect(organisationsEinheitService.patch).toHaveBeenCalledWith(organisationsEinheitSettings);
});
it('should build patched form value', () => {
service.submit();
expect(service.buildPatchedOrganisationsEinheitSettings).toHaveBeenCalled();
});
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment