diff --git a/src/tests/views/Validation.spec.ts b/src/tests/views/Validation.spec.ts index 5283ab48ad..352c1f73a1 100644 --- a/src/tests/views/Validation.spec.ts +++ b/src/tests/views/Validation.spec.ts @@ -184,17 +184,6 @@ vi.mock('../../store/files.js', () => { } }) -vi.mock('../../store/policies', () => { - const policiesStore = { - setPolicies: vi.fn(), - getEffectiveValue: vi.fn(() => ''), - } - - return { - usePoliciesStore: vi.fn(() => policiesStore), - } -}) - // Mock utils vi.mock('../../utils/viewer.js', () => ({ openDocument: vi.fn(), @@ -1074,10 +1063,7 @@ describe('Validation.vue - Business Logic', () => { expect(filesStore.addFile).not.toHaveBeenCalled() }) - it('updates the policies store when requester effective policies are returned', async () => { - const { usePoliciesStore } = await import('../../store/policies') - const policiesStore = usePoliciesStore() - + it('shows the requester legal information returned with the validation', () => { wrapper.vm.handleValidationSuccess({ ...createLoadedValidationDocument({ status: SIGNED_STATUS }), effective_policies: { @@ -1085,25 +1071,12 @@ describe('Validation.vue - Business Logic', () => { legal_information: { policyKey: 'legal_information', effectiveValue: 'Requester legal copy', - sourceScope: 'user_policy', - visible: true, - editableByCurrentActor: false, - allowedValues: [], - canSaveAsUserDefault: false, - canUseAsRequestOverride: false, - preferenceWasCleared: false, - blockedBy: null, }, }, }, }) - expect(policiesStore.setPolicies).toHaveBeenCalledWith({ - legal_information: expect.objectContaining({ - effectiveValue: 'Requester legal copy', - sourceScope: 'user_policy', - }), - }) + expect(wrapper.vm.legalInformation).toBe('Requester legal copy') }) }) diff --git a/tests/php/Integration/Controller/PageControllerTest.php b/tests/php/Integration/Controller/PageControllerTest.php index 05981412ae..5db8075701 100644 --- a/tests/php/Integration/Controller/PageControllerTest.php +++ b/tests/php/Integration/Controller/PageControllerTest.php @@ -20,6 +20,7 @@ use OCA\Libresign\Service\IdentifyMethodService; use OCA\Libresign\Service\Policy\PolicyAuthorizationService; use OCA\Libresign\Service\Policy\PolicyService; +use OCA\Libresign\Service\Policy\ValidationEffectivePolicyService; use OCA\Libresign\Service\RequestSignatureService; use OCA\Libresign\Service\SessionService; use OCA\Libresign\Service\SignerElementsService; @@ -150,6 +151,7 @@ public function setUp(): void { signFileService: $this->signFileService, requestSignatureService: \OCP\Server::get(RequestSignatureService::class), policyService: $this->policyService, + validationEffectivePolicyService: new ValidationEffectivePolicyService($this->policyService), policyAuthorizationService: $this->policyAuthorizationService, signerElementsService: $this->signerElementsService, l10n: $this->createMock(IL10N::class), @@ -343,6 +345,7 @@ public function testValidationFilePublicBootstrapsRequesterPoliciesWithoutUserSc signFileService: $signFileService, requestSignatureService: \OCP\Server::get(RequestSignatureService::class), policyService: $policyService, + validationEffectivePolicyService: new ValidationEffectivePolicyService($policyService), policyAuthorizationService: $this->policyAuthorizationService, signerElementsService: $this->signerElementsService, l10n: $this->createMock(IL10N::class), @@ -362,7 +365,7 @@ public function testValidationFilePublicBootstrapsRequesterPoliciesWithoutUserSc $response = $controller->validationFilePublic('validation-file-uuid'); - self::assertArrayHasKey('effective_policies', $capturedInitialState); + self::assertSame(['policies' => []], $capturedInitialState['effective_policies'] ?? null); self::assertSame('external', $response->getTemplateName()); self::assertSame(TemplateResponse::RENDER_AS_BASE, $response->getRenderAs()); }