-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(integration-test): add get/list membership integration-test (#1324
) Because - add get/list membership integration-test This commit - add get/list membership integration-test
- Loading branch information
Showing
4 changed files
with
96 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { expect, test } from "vitest"; | ||
|
||
import { InstillAPIClient } from "../../main"; | ||
import { | ||
getUserMembershipResponseValidator, | ||
listOrganizationMembershipsResponseValidator, | ||
listUserMembershipsResponseValidator, | ||
} from "./types"; | ||
|
||
test("listUserMemberships", async () => { | ||
const client = new InstillAPIClient({ | ||
baseURL: `http://localhost:8080/${process.env.INSTILL_API_VERSION}`, | ||
apiToken: "test", | ||
debug: true, | ||
}); | ||
|
||
const memberships = await client.core.membership.listUserMemberships({ | ||
userName: "users/uid", | ||
}); | ||
|
||
const parsedData = | ||
listUserMembershipsResponseValidator.safeParse(memberships); | ||
|
||
expect(parsedData.success).toBe(true); | ||
}); | ||
|
||
test("getUserMembership", async () => { | ||
const client = new InstillAPIClient({ | ||
baseURL: `http://localhost:8080/${process.env.INSTILL_API_VERSION}`, | ||
apiToken: "test", | ||
debug: true, | ||
}); | ||
|
||
const membership = await client.core.membership.getUserMembership({ | ||
userMembershipName: "users/uid/memberships/mid", | ||
view: "FULL", | ||
}); | ||
|
||
const parsedData = getUserMembershipResponseValidator.safeParse(membership); | ||
|
||
expect(parsedData.success).toBe(true); | ||
}); | ||
|
||
test("listOrganizationMemberships", async () => { | ||
const client = new InstillAPIClient({ | ||
baseURL: `http://localhost:8080/${process.env.INSTILL_API_VERSION}`, | ||
apiToken: "test", | ||
debug: true, | ||
}); | ||
|
||
const memberships = await client.core.membership.listOrganizationMemberships({ | ||
organizationName: "organizations/oid", | ||
}); | ||
|
||
const parsedData = | ||
listOrganizationMembershipsResponseValidator.safeParse(memberships); | ||
|
||
expect(parsedData.success).toBe(true); | ||
}); | ||
|
||
test("getOrganizationMembership", async () => { | ||
const client = new InstillAPIClient({ | ||
baseURL: `http://localhost:8080/${process.env.INSTILL_API_VERSION}`, | ||
apiToken: "test", | ||
debug: true, | ||
}); | ||
|
||
const membership = await client.core.membership.getOrganizationMembership({ | ||
organizationMembershipName: "organizations/oid/memberships/mid", | ||
view: "FULL", | ||
}); | ||
|
||
const parsedData = getUserMembershipResponseValidator.safeParse(membership); | ||
|
||
expect(parsedData.success).toBe(true); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters