Skip to content
Draft
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
19 changes: 17 additions & 2 deletions integration-tests/testkit/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import {
import { execute } from './graphql';
import { UpdateSchemaPolicyForOrganization, UpdateSchemaPolicyForProject } from './schema-policy';
import { collect, CollectedOperation, legacyCollect } from './usage';
import { generateUnique } from './utils';
import { generateUnique, getServiceHost } from './utils';

export function initSeed() {
function createConnectionPool() {
Expand All @@ -87,6 +87,17 @@ export function initSeed() {
},
};
},
async purgePersonalAccessTokenById(id: string) {
const registryAddress = await getServiceHost('server', 8082);
(
await fetch(
'http://' + registryAddress + '/cache/personal-access-token-cache/delete/' + id,
{
method: 'POST',
},
)
).json();
},
authenticate,
generateEmail: () => userEmail(generateUnique()),
async createOwner() {
Expand Down Expand Up @@ -880,7 +891,10 @@ export function initSeed() {
},
};
},
async inviteAndJoinMember(inviteToken: string = ownerToken) {
async inviteAndJoinMember(
memberRoleId: string | undefined = undefined,
inviteToken: string = ownerToken,
) {
const memberEmail = userEmail(generateUnique());
const memberToken = await authenticate(memberEmail).then(r => r.access_token);

Expand All @@ -892,6 +906,7 @@ export function initSeed() {
},
},
email: memberEmail,
memberRoleId,
},
inviteToken,
).then(r => r.expectNoGraphQLErrors());
Expand Down
9 changes: 9 additions & 0 deletions integration-tests/testkit/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,12 @@ export function assertNonNull<T>(
throw new Error(message);
}
}

export function assertNonNullish<T>(
value: T | null | undefined,
message = 'Expected non-null value.',
): asserts value is T {
if (value === null) {
throw new Error(message);
}
}
1 change: 1 addition & 0 deletions integration-tests/tests/api/organization/members.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
const { createOrg } = await initSeed().createOwner();
const { organization } = await createOrg();

expect(organization.owner.role.permissions).toMatchInlineSnapshot(`

Check failure on line 10 in integration-tests/tests/api/organization/members.spec.ts

View workflow job for this annotation

GitHub Actions / test / integration (2)

tests/api/organization/members.spec.ts > owner of an organization should have all scopes

Error: Snapshot `owner of an organization should have all scopes 1` mismatched - Expected + Received @@ -26,7 +26,16 @@ targetAccessToken:modify, cdnAccessToken:modify, laboratory:describe, laboratory:modify, laboratory:modifyPreflightScript, - schemaCheck:approve, + schema:compose, + usage:report, + traces:report, + schemaCheck:approve, + schemaCheck:create, + schemaVersion:publish, + schemaVersion:deleteService, + appDeployment:create, + appDeployment:publish, + appDeployment:retire, ] ❯ tests/api/organization/members.spec.ts:10:47
[
organization:describe,
support:manageTickets,
accessToken:modify,
personalAccessToken:modify,
organization:modifySlug,
auditLog:export,
organization:delete,
Expand Down
Loading
Loading