Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PIN-5883 deletePurpose delegation test #1338

Open
wants to merge 36 commits into
base: feature/incaricato
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c9a39a8
feat: create purpose by delegate, add check on delegate
AsterITA Dec 19, 2024
2e7859c
fix getDelegation using correct params
AsterITA Dec 20, 2024
d27dff3
added check for delegate on activate and suspend, various fixes
AsterITA Dec 20, 2024
1b7a682
readded eslint on arrow function
AsterITA Dec 20, 2024
9ab6c3c
removed delegationId from input in createPurpose
AsterITA Dec 20, 2024
a5842a1
Merge branch 'feature/incaricato' into PIN-5816_createPurposeDelegation
AsterITA Jan 7, 2025
0ad08ef
applied suggestions from review
AsterITA Jan 7, 2025
3befcdc
fix tests
AsterITA Jan 7, 2025
e18bfd6
added missing tests
rGregnanin Jan 7, 2025
5832ff2
Merge branch 'PIN-5816_createPurposeDelegation' into PIN-5881-UpdateP…
rGregnanin Jan 7, 2025
e241b48
minor refactor on getOrganizationRole
AsterITA Jan 7, 2025
0716349
fix tests
rGregnanin Jan 7, 2025
a76e5d4
Merge branch 'PIN-5816_createPurposeDelegation' into PIN-5881-UpdateP…
rGregnanin Jan 7, 2025
7a5d27a
added delegation tests for deletePurpose
rGregnanin Jan 8, 2025
dac1f7a
bump outbound, added delegationId in Purpose where missing
AsterITA Jan 8, 2025
33a06e2
Merge branch 'PIN-5816_createPurposeDelegation' into PIN-5881-UpdateP…
rGregnanin Jan 8, 2025
52c90f5
Merge branch 'PIN-5881-UpdatePurposeDelegtionTest' into PIN-5883-Dele…
rGregnanin Jan 8, 2025
b639a79
added test
rGregnanin Jan 9, 2025
340ecfa
added missing delegationIds
AsterITA Jan 9, 2025
7612687
added test
rGregnanin Jan 9, 2025
a472388
Merge branch 'PIN-5881-UpdatePurposeDelegtionTest' into PIN-5883-Dele…
rGregnanin Jan 10, 2025
be782d6
added test
rGregnanin Jan 10, 2025
21372de
fix name
rGregnanin Jan 10, 2025
c8e5300
fix name
rGregnanin Jan 10, 2025
d9345e1
Merge branch 'PIN-5881-UpdatePurposeDelegtionTest' into PIN-5883-Dele…
rGregnanin Jan 10, 2025
93e0d58
added missing checks for delegate
AsterITA Jan 13, 2025
9c2e428
fix tests
AsterITA Jan 13, 2025
8a46dd7
Merge branch 'PIN-5816_createPurposeDelegation' into PIN-5881-UpdateP…
rGregnanin Jan 13, 2025
d86fb40
Merge branch 'feature/incaricato' into PIN-5881-UpdatePurposeDelegtio…
rGregnanin Jan 15, 2025
85a2205
WIP
rGregnanin Jan 15, 2025
1370f3d
fix
rGregnanin Jan 16, 2025
c9ceae3
Merge branch 'PIN-5881-UpdatePurposeDelegtionTest' into PIN-5883-Dele…
rGregnanin Jan 16, 2025
17c96a4
fix
rGregnanin Jan 16, 2025
85d4d06
minor fix
rGregnanin Jan 16, 2025
c78b5bf
Merge branch 'feature/incaricato' into PIN-5883-DeletePurposeDelegati…
rGregnanin Jan 17, 2025
53bf7ab
added tests
rGregnanin Jan 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions packages/agreement-process/test/activateAgreement.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
timeAtRomeZone,
} from "pagopa-interop-commons";
import {
addSomeRandomDelegations,
decodeProtobufPayload,
getMockAgreement,
getMockAgreementAttribute,
Expand Down Expand Up @@ -83,7 +84,6 @@ import {
addOneDelegation,
addOneEService,
addOneTenant,
addSomeRandomDelegations,
agreementService,
authDataAndDelegationsFromRequesterIs,
fileManager,
Expand Down Expand Up @@ -309,7 +309,7 @@ describe("activate agreement", () => {
await addOneAttribute(verifiedAttribute);
const relatedAgreements = await addRelatedAgreements(agreement);

await addSomeRandomDelegations(agreement);
await addSomeRandomDelegations(agreement, addOneDelegation);
await addDelegationsAndDelegates({
producerDelegation,
delegateProducer,
Expand Down Expand Up @@ -719,7 +719,7 @@ describe("activate agreement", () => {

await addOneAgreement(agreement);
await addOneDelegation(consumerDelegation);
await addSomeRandomDelegations(agreement);
await addSomeRandomDelegations(agreement, addOneDelegation);

await expect(
agreementService.activateAgreement(agreement.id, {
Expand Down Expand Up @@ -750,7 +750,7 @@ describe("activate agreement", () => {

await addOneAgreement(agreement);
await addOneDelegation(producerDelegation);
await addSomeRandomDelegations(agreement);
await addSomeRandomDelegations(agreement, addOneDelegation);

await expect(
agreementService.activateAgreement(agreement.id, {
Expand Down Expand Up @@ -881,7 +881,7 @@ describe("activate agreement", () => {
await addOneAgreement(agreement);
const relatedAgreements = await addRelatedAgreements(agreement);

await addSomeRandomDelegations(agreement);
await addSomeRandomDelegations(agreement, addOneDelegation);
await addDelegationsAndDelegates({
producerDelegation,
delegateProducer,
Expand Down Expand Up @@ -1237,7 +1237,7 @@ describe("activate agreement", () => {
await addOneAgreement(agreement);
const relatedAgreements = await addRelatedAgreements(agreement);

await addSomeRandomDelegations(agreement);
await addSomeRandomDelegations(agreement, addOneDelegation);
await addDelegationsAndDelegates({
producerDelegation,
delegateProducer,
Expand Down Expand Up @@ -1299,7 +1299,7 @@ describe("activate agreement", () => {
await addOneAgreement(agreement);
const relatedAgreements = await addRelatedAgreements(agreement);

await addSomeRandomDelegations(agreement);
await addSomeRandomDelegations(agreement, addOneDelegation);
await addDelegationsAndDelegates({
producerDelegation,
delegateProducer,
Expand Down Expand Up @@ -1538,7 +1538,7 @@ describe("activate agreement", () => {
await addOneAgreement(agreement);
const relatedAgreements = await addRelatedAgreements(agreement);

await addSomeRandomDelegations(agreement);
await addSomeRandomDelegations(agreement, addOneDelegation);
await addDelegationsAndDelegates({
producerDelegation,
delegateProducer,
Expand Down Expand Up @@ -1593,7 +1593,7 @@ describe("activate agreement", () => {
await addOneAgreement(agreement);
const relatedAgreements = await addRelatedAgreements(agreement);

await addSomeRandomDelegations(agreement);
await addSomeRandomDelegations(agreement, addOneDelegation);
await addDelegationsAndDelegates({
producerDelegation,
delegateProducer,
Expand Down Expand Up @@ -1673,7 +1673,7 @@ describe("activate agreement", () => {

await addOneAgreement(agreement);
await addOneDelegation(producerDelegation);
await addSomeRandomDelegations(agreement);
await addSomeRandomDelegations(agreement, addOneDelegation);

await expect(
agreementService.activateAgreement(agreement.id, {
Expand Down Expand Up @@ -1704,7 +1704,7 @@ describe("activate agreement", () => {

await addOneAgreement(agreement);
await addOneDelegation(consumerDelegation);
await addSomeRandomDelegations(agreement);
await addSomeRandomDelegations(agreement, addOneDelegation);

await expect(
agreementService.activateAgreement(agreement.id, {
Expand Down Expand Up @@ -1758,7 +1758,7 @@ describe("activate agreement", () => {
await addOneAgreement(agreement);
await addOneDelegation(producerDelegation);
await addOneDelegation(consumerDelegation);
await addSomeRandomDelegations(agreement);
await addSomeRandomDelegations(agreement, addOneDelegation);

await expect(
agreementService.activateAgreement(agreement.id, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { generateMock } from "@anatine/zod-mock";
import { fileManagerDeleteError, genericLogger } from "pagopa-interop-commons";
import {
addSomeRandomDelegations,
decodeProtobufPayload,
getMockAgreement,
getMockDelegation,
Expand Down Expand Up @@ -42,7 +43,6 @@ import {
addOneDelegation,
addOneEService,
addOneTenant,
addSomeRandomDelegations,
agreementService,
fileManager,
getMockConsumerDocument,
Expand Down Expand Up @@ -126,7 +126,7 @@ describe("agreement consumer document", () => {
await addOneEService(eservice);
await addOneAgreement(agreement);
await addOneDelegation(delegation);
await addSomeRandomDelegations(agreement);
await addSomeRandomDelegations(agreement, addOneDelegation);

const result = await agreementService.getAgreementConsumerDocument(
agreement.id,
Expand Down Expand Up @@ -167,7 +167,7 @@ describe("agreement consumer document", () => {

await addOneAgreement(agreement);
await addOneDelegation(delegation);
await addSomeRandomDelegations(agreement);
await addSomeRandomDelegations(agreement, addOneDelegation);

for (const document of consumerDocuments) {
const result = await agreementService.getAgreementConsumerDocument(
Expand Down Expand Up @@ -429,7 +429,7 @@ describe("agreement consumer document", () => {
state: delegationState.active,
});
await addOneDelegation(delegation);
await addSomeRandomDelegations(agreement);
await addSomeRandomDelegations(agreement, addOneDelegation);

const returnedConsumerDocument =
await agreementService.addConsumerDocument(
Expand Down Expand Up @@ -543,7 +543,7 @@ describe("agreement consumer document", () => {
state: delegationState.active,
});
await addOneDelegation(delegation);
await addSomeRandomDelegations(agreement);
await addSomeRandomDelegations(agreement, addOneDelegation);

const actualConsumerDocument = agreementService.addConsumerDocument(
agreement.id,
Expand Down Expand Up @@ -699,7 +699,7 @@ describe("agreement consumer document", () => {
});

await addOneDelegation(delegation);
await addSomeRandomDelegations(agreement1);
await addSomeRandomDelegations(agreement1, addOneDelegation);

await uploadDocument(
agreement1.id,
Expand Down
4 changes: 2 additions & 2 deletions packages/agreement-process/test/archiveAgreement.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { fail } from "assert";
import { genericLogger } from "pagopa-interop-commons";
import {
addSomeRandomDelegations,
decodeProtobufPayload,
getMockAgreement,
getMockDelegation,
Expand Down Expand Up @@ -30,7 +31,6 @@ import {
import {
addOneAgreement,
addOneDelegation,
addSomeRandomDelegations,
agreementService,
readLastAgreementEvent,
} from "./utils.js";
Expand Down Expand Up @@ -124,7 +124,7 @@ describe("archive agreement", () => {

await addOneAgreement(agreement);
await addOneDelegation(delegation);
await addSomeRandomDelegations(agreement);
await addSomeRandomDelegations(agreement, addOneDelegation);

const returnedAgreement = await agreementService.archiveAgreement(
agreement.id,
Expand Down
6 changes: 3 additions & 3 deletions packages/agreement-process/test/cloneAgreement.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/* eslint-disable fp/no-delete */
import { FileManagerError, genericLogger } from "pagopa-interop-commons";
import {
addSomeRandomDelegations,
decodeProtobufPayload,
getMockAgreement,
getMockCertifiedTenantAttribute,
Expand Down Expand Up @@ -50,7 +51,6 @@ import {
addOneDelegation,
addOneEService,
addOneTenant,
addSomeRandomDelegations,
agreementService,
fileManager,
getMockConsumerDocument,
Expand Down Expand Up @@ -275,7 +275,7 @@ describe("clone agreement", () => {
state: delegationState.active,
});
await addOneDelegation(delegation);
await addSomeRandomDelegations(agreementToBeCloned);
await addSomeRandomDelegations(agreementToBeCloned, addOneDelegation);

const anotherNonConflictingAgreement = {
...getMockAgreement(
Expand Down Expand Up @@ -415,7 +415,7 @@ describe("clone agreement", () => {
state: delegationState.active,
});
await addOneDelegation(delegation);
await addSomeRandomDelegations(agreement);
await addSomeRandomDelegations(agreement, addOneDelegation);
await expect(
agreementService.cloneAgreement(agreement.id, {
authData,
Expand Down
4 changes: 2 additions & 2 deletions packages/agreement-process/test/deleteAgreement.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable functional/no-let */
import { fileManagerDeleteError, genericLogger } from "pagopa-interop-commons";
import {
addSomeRandomDelegations,
decodeProtobufPayload,
getMockAgreement,
getMockDelegation,
Expand All @@ -27,7 +28,6 @@ import { config } from "../src/config/config.js";
import {
addOneAgreement,
addOneDelegation,
addSomeRandomDelegations,
agreementService,
fileManager,
getMockConsumerDocument,
Expand Down Expand Up @@ -125,7 +125,7 @@ describe("delete agreement", () => {

await addOneAgreement(agreement);
await addOneDelegation(delegation);
await addSomeRandomDelegations(agreement);
await addSomeRandomDelegations(agreement, addOneDelegation);

await Promise.all(
consumerDocuments.map((doc) =>
Expand Down
14 changes: 7 additions & 7 deletions packages/agreement-process/test/submitAgreement.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
} from "pagopa-interop-commons";
import { addDays, subDays } from "date-fns";
import {
addSomeRandomDelegations,
decodeProtobufPayload,
getMockAgreement,
getMockAttribute,
Expand Down Expand Up @@ -77,7 +78,6 @@ import {
addOneDelegation,
addOneEService,
addOneTenant,
addSomeRandomDelegations,
agreementService,
authDataAndDelegationsFromRequesterIs,
fileManager,
Expand Down Expand Up @@ -1076,7 +1076,7 @@ describe("submit agreement", () => {
await addOneTenant(producerAndConsumer);
await addOneTenant(producer);
await addOneAgreement(agreement);
await addSomeRandomDelegations(agreement);
await addSomeRandomDelegations(agreement, addOneDelegation);
await addDelegationsAndDelegates({
producerDelegation,
delegateProducer,
Expand Down Expand Up @@ -1267,7 +1267,7 @@ describe("submit agreement", () => {
await addOneAttribute(declaredAttribute);
await addOneAttribute(certifiedAttribute);
await addOneAgreement(agreement);
await addSomeRandomDelegations(agreement);
await addSomeRandomDelegations(agreement, addOneDelegation);
await addDelegationsAndDelegates({
producerDelegation,
delegateProducer,
Expand Down Expand Up @@ -1509,7 +1509,7 @@ describe("submit agreement", () => {
await addOneTenant(consumer);
await addOneTenant(producer);
await addOneAgreement(agreement);
await addSomeRandomDelegations(agreement);
await addSomeRandomDelegations(agreement, addOneDelegation);
await addDelegationsAndDelegates({
producerDelegation: undefined,
delegateProducer: undefined,
Expand Down Expand Up @@ -1710,7 +1710,7 @@ describe("submit agreement", () => {
await addOneAttribute(declaredAttribute);
await addOneAttribute(certifiedAttribute);
await addOneAgreement(agreement);
await addSomeRandomDelegations(agreement);
await addSomeRandomDelegations(agreement, addOneDelegation);
await addDelegationsAndDelegates({
producerDelegation,
delegateProducer,
Expand Down Expand Up @@ -1992,7 +1992,7 @@ describe("submit agreement", () => {
await addOneAttribute(declaredAttribute);
await addOneAttribute(verifiedAttribute);
await addOneAgreement(agreement);
await addSomeRandomDelegations(agreement);
await addSomeRandomDelegations(agreement, addOneDelegation);
await addDelegationsAndDelegates({
producerDelegation: undefined,
delegateProducer: undefined,
Expand Down Expand Up @@ -2148,7 +2148,7 @@ describe("submit agreement", () => {
await addOneAttribute(declaredAttribute);
await addOneAttribute(verifiedAttribute);
await addOneAgreement(agreement);
await addSomeRandomDelegations(agreement);
await addSomeRandomDelegations(agreement, addOneDelegation);
await addDelegationsAndDelegates({
producerDelegation: undefined,
delegateProducer: undefined,
Expand Down
4 changes: 2 additions & 2 deletions packages/agreement-process/test/updateAgreement.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
decodeProtobufPayload,
randomArrayItem,
getMockDelegation,
addSomeRandomDelegations,
} from "pagopa-interop-commons-test";
import {
AgreementId,
Expand All @@ -27,7 +28,6 @@ import { agreementUpdatableStates } from "../src/model/domain/agreement-validato
import {
addOneAgreement,
addOneDelegation,
addSomeRandomDelegations,
agreementService,
readLastAgreementEvent,
} from "./utils.js";
Expand Down Expand Up @@ -153,7 +153,7 @@ describe("update agreement", () => {
});
await addOneAgreement(agreement);
await addOneDelegation(delegation);
await addSomeRandomDelegations(agreement);
await addSomeRandomDelegations(agreement, addOneDelegation);

const returnedAgreement = await agreementService.updateAgreement(
agreement.id,
Expand Down
8 changes: 4 additions & 4 deletions packages/agreement-process/test/upgradeAgreement.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
timeAtRomeZone,
} from "pagopa-interop-commons";
import {
addSomeRandomDelegations,
decodeProtobufPayload,
getMockAgreement,
getMockAttribute,
Expand Down Expand Up @@ -72,7 +73,6 @@ import {
addOneDelegation,
addOneEService,
addOneTenant,
addSomeRandomDelegations,
agreementService,
authDataAndDelegationsFromRequesterIs,
fileManager,
Expand Down Expand Up @@ -181,7 +181,7 @@ describe("upgrade Agreement", () => {

const { authData, consumerDelegation, delegateConsumer } =
authDataAndDelegationsFromRequesterIs(requesterIs, agreement);
await addSomeRandomDelegations(agreement);
await addSomeRandomDelegations(agreement, addOneDelegation);
await addDelegationsAndDelegates({
producerDelegation: undefined,
delegateProducer: undefined,
Expand Down Expand Up @@ -436,7 +436,7 @@ describe("upgrade Agreement", () => {
})
: undefined;

await addSomeRandomDelegations(agreement);
await addSomeRandomDelegations(agreement, addOneDelegation);
await addDelegationsAndDelegates({
producerDelegation,
delegateProducer,
Expand Down Expand Up @@ -801,7 +801,7 @@ describe("upgrade Agreement", () => {
const { authData, consumerDelegation, delegateConsumer } =
authDataAndDelegationsFromRequesterIs(requesterIs, agreement);

await addSomeRandomDelegations(agreement);
await addSomeRandomDelegations(agreement, addOneDelegation);
await addDelegationsAndDelegates({
producerDelegation: undefined,
delegateProducer: undefined,
Expand Down
Loading
Loading