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-5884 archivePurposeVersion delegation test #1339

Open
wants to merge 37 commits into
base: feature/incaricato
Choose a base branch
from

Conversation

rGregnanin
Copy link
Contributor

No description provided.

@rGregnanin rGregnanin marked this pull request as ready for review January 10, 2025 16:26
@@ -160,6 +177,207 @@ describe("archivePurposeVersion", () => {

vi.useRealTimers();
});
it("should succeed when requester is Consumer Delegate and the Purpose is in a archived state", async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it("should succeed when requester is Consumer Delegate and the Purpose is in a archived state", async () => {
it("should write on event-store for the archiving of a purpose version when requester is Consumer Delegate", async () => {


vi.useRealTimers();
});
it("should succeed when requester is Consumer Delegate and the eservice was created by a delegated tenant and the Purpose is in a archived state", async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it("should succeed when requester is Consumer Delegate and the eservice was created by a delegated tenant and the Purpose is in a archived state", async () => {
it("should write on event-store for the archiving of a purpose version when requester is Consumer Delegate and the eservice was created by a delegated tenant", async () => {

state: purposeVersionState.active,
};

const delegatePurpose: Purpose = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in order to be a purpose created by the delegate you have to add delegationId

Copy link
Collaborator

@ecamellini ecamellini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!
You could also add two tests for the following error cases:

  • the requester is a delegate for the eservice and is archiving a purpose with no delegationId
  • the requester is a delegate for the eservice and is archiving a purpose for a different delegationId (a different delegate)

const mockPurpose: Purpose = {
...getMockPurpose(),
versions: [mockPurposeVersion],
consumerId: generateId<TenantId>(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
consumerId: generateId<TenantId>(),
consumerId: authData.organizationId

...getMockPurpose(),
versions: [mockPurposeVersion],
consumerId: generateId<TenantId>(),
delegationId: generateId<DelegationId>(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
delegationId: generateId<DelegationId>(),
delegationId: generateId<DelegationId>(),
consumerId: authData.organizationId

Base automatically changed from PIN-5881-UpdatePurposeDelegtionTest to feature/incaricato January 17, 2025 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants