Skip to content

Commit e80d984

Browse files
committed
add live test for iam
1 parent aad2ca4 commit e80d984

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/live/iam.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,36 @@ import { expect, test } from "vitest";
22
import { createJwt } from "./utils.js";
33
import {
44
EntraActionResponse,
5+
GroupGetResponse,
56
GroupMemberGetResponse,
67
} from "../../src/common/types/iam.js";
78
import { allAppRoles, AppRoles } from "../../src/common/roles.js";
89
import { getBaseEndpoint } from "./utils.js";
910

1011
const baseEndpoint = getBaseEndpoint();
12+
test("getting groups", async () => {
13+
const token = await createJwt();
14+
const response = await fetch(`${baseEndpoint}/api/v1/iam/groups`, {
15+
method: "GET",
16+
headers: {
17+
Authorization: `Bearer ${token}`,
18+
"Content-Type": "application/json",
19+
},
20+
});
21+
expect(response.status).toBe(200);
22+
const responseJson = (await response.json()) as GroupGetResponse;
23+
expect(responseJson.length).greaterThan(0);
24+
for (const item of responseJson) {
25+
expect(item).toHaveProperty("displayName");
26+
expect(item).toHaveProperty("id");
27+
expect(item["displayName"].length).greaterThan(0);
28+
expect(item["id"].length).greaterThan(0);
29+
expect(item["id"].length).toMatch(
30+
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/,
31+
);
32+
}
33+
});
34+
1135
test("getting members of a group", async () => {
1236
const token = await createJwt();
1337
const response = await fetch(

0 commit comments

Comments
 (0)