-
Notifications
You must be signed in to change notification settings - Fork 1
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
base: feature/incaricato
Are you sure you want to change the base?
PIN-5884 archivePurposeVersion delegation test #1339
Conversation
…urposeDelegtionTest
…urposeDelegtionTest
…urposeDelegtionTest
…ivePurposeVersionDelegationTest
…ivePurposeVersionDelegationTest
…ivePurposeVersionDelegationTest
@@ -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 () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 = { |
There was a problem hiding this comment.
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
…ivePurposeVersionDelegationTest
…ivePurposeVersionDelegationTest
There was a problem hiding this 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>(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consumerId: generateId<TenantId>(), | |
consumerId: authData.organizationId |
...getMockPurpose(), | ||
versions: [mockPurposeVersion], | ||
consumerId: generateId<TenantId>(), | ||
delegationId: generateId<DelegationId>(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delegationId: generateId<DelegationId>(), | |
delegationId: generateId<DelegationId>(), | |
consumerId: authData.organizationId |
No description provided.