Skip to content

Commit 11c08d1

Browse files
committed
test(client-sts): copy test file manually
1 parent 04e020d commit 11c08d1

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

clients/client-sts/test/defaultRoleAssumers.spec.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,17 @@ describe("getDefaultRoleAssumer", () => {
8989
);
9090
});
9191

92+
it("should return accountId in the credentials", async () => {
93+
const roleAssumer = getDefaultRoleAssumer();
94+
const params: AssumeRoleCommandInput = {
95+
RoleArn: "arn:aws:foo",
96+
RoleSessionName: "session",
97+
};
98+
const sourceCred = { accessKeyId: "key", secretAccessKey: "secrete" };
99+
const assumedRole = await roleAssumer(sourceCred, params);
100+
expect(assumedRole.accountId).toEqual("123456789012");
101+
});
102+
92103
it("should use the STS client config", async () => {
93104
const logger = console;
94105
const region = "some-region";
@@ -209,6 +220,17 @@ describe("getDefaultRoleAssumerWithWebIdentity", () => {
209220
});
210221
});
211222

223+
it("should return accountId in the credentials", async () => {
224+
const roleAssumerWithWebIdentity = getDefaultRoleAssumerWithWebIdentity();
225+
const params: AssumeRoleWithWebIdentityCommandInput = {
226+
RoleArn: "arn:aws:foo",
227+
RoleSessionName: "session",
228+
WebIdentityToken: "token",
229+
};
230+
const assumedRole = await roleAssumerWithWebIdentity(params);
231+
expect(assumedRole.accountId).toEqual("123456789012");
232+
});
233+
212234
it("should use the STS client middleware", async () => {
213235
const customMiddlewareFunction = jest.fn();
214236
const roleAssumerWithWebIdentity = getDefaultRoleAssumerWithWebIdentity({}, [

0 commit comments

Comments
 (0)