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

Minor tweak to test to show nested-role authorized query + minor typo fixes. #808

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions tests/features/author-delegated-grant.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export function testAuthorDelegatedGrant(): void {
protocolDefinition : emailProtocolDefinition,
});

// Bob should be abel to configure a protocol on behalf of alice
// Bob should be able to configure a protocol on behalf of alice
const protocolConfigureReply = await dwn.processMessage(alice.did, protocolConfigure.message);
expect(protocolConfigureReply.status.code).to.equal(202);

Expand Down Expand Up @@ -147,7 +147,7 @@ export function testAuthorDelegatedGrant(): void {
protocolDefinition : emailProtocolDefinition,
});

// Bob should be abel to configure a protocol on behalf of alice
// Bob should be able to configure a protocol on behalf of alice
const protocolConfigureReply = await dwn.processMessage(alice.did, protocolConfigure.message);
expect(protocolConfigureReply.status.code).to.equal(202);

Expand Down
17 changes: 16 additions & 1 deletion tests/scenarios/nested-roles.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@ export function testNestedRoleScenarios(): void {
// 4. Bob can invoke his `admin` role to perform actions:
// 4a. Bob can read the community record
// 4b. Bob can create gated-channels 1 & 2 in the community
// 4c. Bob can query all gated-channels in the community
// 5. Bob as the creator/author of the channels can add participants in the gated-channels
// 5a. Bob can add himself and Carol as participants in the gated-channel 1
// 5b. Bob can add himself and Daniel as participants in the gated-channel 2
// 6. Carol can read the gated channel 2 record by invoking her child participant role to the gated channel 2
// 6. Carol can read the gated channel 1 record by invoking her child participant role to the gated channel 1
// 7. Carol CANNOT add anyone as a participant in the gated-channel 2 since she is not a participant in the channel
// 8. Carol CANNOT add Daniel as another participant in the gated-channel without invoking her role
// 9. Carol can invoke her participant role to add Daniel as another participant in the gated-channel
Expand Down Expand Up @@ -151,6 +152,20 @@ export function testNestedRoleScenarios(): void {
const channel2RecordReply = await dwn.processMessage(alice.did, channel2Record.message, { dataStream: channel2Record.dataStream });
expect(channel2RecordReply.status.code).to.equal(202);

// 4c. Bob can query all gated-channels in the community
const bobQuery = await RecordsQuery.create({
signer : Jws.createSigner(bob),
protocolRole : 'community/admin',
filter : {
protocol : protocolDefinition.protocol,
protocolPath : 'community/gatedChannel',
contextId : communityRecord.message.contextId
}
});
const bobQueryReply = await dwn.processMessage(alice.did, bobQuery.message);
expect(bobQueryReply.status.code).to.equal(200);
expect(bobQueryReply.entries?.length).to.equal(2);

// 5. Bob as the creator/author of the channels can add participants in the gated-channels
// 5a. Bob can add himself and Carol as participants in the gated-channel 1
const channel1ParticipantBobRecord = await TestDataGenerator.generateRecordsWrite({
Expand Down
1 change: 1 addition & 0 deletions tests/vectors/protocol-definitions/slack.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
"can": [
"create",
"update",
"query",
"co-delete"
]
},
Expand Down