Skip to content

Commit

Permalink
Add feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
NSeydoux committed Dec 18, 2024
1 parent 5b6792b commit 0ff612c
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 48 deletions.
1 change: 1 addition & 0 deletions .github/workflows/e2e-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ jobs:
E2E_TEST_OWNER_CLIENT_ID: ${{ secrets.E2E_TEST_OWNER_CLIENT_ID }}
E2E_TEST_OWNER_CLIENT_SECRET: ${{ secrets.E2E_TEST_OWNER_CLIENT_SECRET }}
E2E_TEST_FEATURE_RECURSIVE_ACCESS_GRANTS: ${{ secrets.E2E_TEST_FEATURE_RECURSIVE_ACCESS_GRANTS }}
E2E_TEST_FEATURE_QUERY_ENDPOINT: ${{ secrets.E2E_TEST_FEATURE_QUERY_ENDPOINT }}
99 changes: 51 additions & 48 deletions e2e/node/e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1715,57 +1715,60 @@ describe(`End-to-end access grant tests for environment [${environment}] `, () =
},
);

describe("query endpoint", () => {
it("can navigate the paginated results", async () => {
const allCredentialsPageOne = await query(
{ pageSize: 10 },
{
describeIf(environmentFeatures?.QUERY_ENDPOINT === "true")(
"query endpoint",
() => {
it("can navigate the paginated results", async () => {
const allCredentialsPageOne = await query(
{ pageSize: 10 },
{
fetch: addUserAgent(requestorSession.fetch, TEST_USER_AGENT),
// FIXME add query endpoint discovery check.
queryEndpoint: new URL("query", vcProvider),
},
);
// We should get the expected page length.
expect(allCredentialsPageOne.items).toHaveLength(10);
// The first page should not have a "prev" link.
expect(allCredentialsPageOne.prev).toBeUndefined();
expect(allCredentialsPageOne.next).toBeDefined();

// Go to the next result page
const allCredentialsPageTwo = await query(allCredentialsPageOne.next!, {
fetch: addUserAgent(requestorSession.fetch, TEST_USER_AGENT),
// FIXME add query endpoint discovery check.
queryEndpoint: new URL("query", vcProvider),
},
);
// We should get the expected page length.
expect(allCredentialsPageOne.items).toHaveLength(10);
// The first page should not have a "prev" link.
expect(allCredentialsPageOne.prev).toBeUndefined();
expect(allCredentialsPageOne.next).toBeDefined();

// Go to the next result page
const allCredentialsPageTwo = await query(allCredentialsPageOne.next!, {
fetch: addUserAgent(requestorSession.fetch, TEST_USER_AGENT),
// FIXME add query endpoint discovery check.
queryEndpoint: new URL("query", vcProvider),
});
expect(allCredentialsPageTwo.items).toHaveLength(10);
});
expect(allCredentialsPageTwo.items).toHaveLength(10);
});

it("can filter based on one or more criteria", async () => {
const onType = await query(
{ type: "SolidAccessGrant" },
{
fetch: addUserAgent(requestorSession.fetch, TEST_USER_AGENT),
// FIXME add query endpoint discovery check.
queryEndpoint: new URL("query", vcProvider),
},
);
expect(onType.items).not.toHaveLength(0);
const onTypeAndStatus = await query(
{
type: "SolidAccessGrant",
status: "Active",
issuedWithin: DURATION.ONE_DAY,
},
{
fetch: addUserAgent(requestorSession.fetch, TEST_USER_AGENT),
// FIXME add query endpoint discovery check.
queryEndpoint: new URL("query", vcProvider),
},
);
expect(onTypeAndStatus.items).not.toHaveLength(0);
expect(onTypeAndStatus.items.length).toBeLessThanOrEqual(
onType.items.length,
);
});
});
it("can filter based on one or more criteria", async () => {
const onType = await query(
{ type: "SolidAccessGrant" },
{
fetch: addUserAgent(requestorSession.fetch, TEST_USER_AGENT),
// FIXME add query endpoint discovery check.
queryEndpoint: new URL("query", vcProvider),
},
);
expect(onType.items).not.toHaveLength(0);
const onTypeAndStatus = await query(
{
type: "SolidAccessGrant",
status: "Active",
issuedWithin: DURATION.ONE_DAY,
},
{
fetch: addUserAgent(requestorSession.fetch, TEST_USER_AGENT),
// FIXME add query endpoint discovery check.
queryEndpoint: new URL("query", vcProvider),
},
);
expect(onTypeAndStatus.items).not.toHaveLength(0);
expect(onTypeAndStatus.items.length).toBeLessThanOrEqual(
onType.items.length,
);
});
},
);
});

0 comments on commit 0ff612c

Please sign in to comment.