diff --git a/src/commands/__tests__/ls.test.ts b/src/commands/__tests__/ls.test.ts index fa9c01b..c4c21c9 100644 --- a/src/commands/__tests__/ls.test.ts +++ b/src/commands/__tests__/ls.test.ts @@ -26,7 +26,7 @@ describe("ls", () => { }); it("should print list response", async () => { - await lsCommand(yargs).parse(command); + await lsCommand(yargs()).parse(command); expect(mockPrint1.mock.calls).toMatchSnapshot(); expect(mockPrint2.mock.calls).toMatchSnapshot(); }); @@ -52,7 +52,7 @@ Unknown argument: foo`, }); it("should print error message", async () => { - const error = await failure(lsCommand(yargs), command); + const error = await failure(lsCommand(yargs()), command); expect(error).toMatchSnapshot(); }); }); diff --git a/src/commands/__tests__/request.test.ts b/src/commands/__tests__/request.test.ts index c0b7c55..7f266e0 100644 --- a/src/commands/__tests__/request.test.ts +++ b/src/commands/__tests__/request.test.ts @@ -41,7 +41,7 @@ describe("request", () => { (isPreexisting, isPersistent, should) => { it(`should${should ? "" : " not"} print request response`, async () => { mockFetch({ isPreexisting, isPersistent }); - await requestCommand(yargs).parse(command); + await requestCommand(yargs()).parse(command); expect(mockPrint2.mock.calls).toMatchSnapshot(); expect(mockPrint1).not.toHaveBeenCalled(); }); @@ -50,7 +50,7 @@ describe("request", () => { it("should wait for access", async () => { mockFetch(); - const promise = requestCommand(yargs).parse(`${command} --wait`); + const promise = requestCommand(yargs()).parse(`${command} --wait`); const wait = sleep(10); await expect(wait).resolves.toBeUndefined(); (onSnapshot as any).trigger({ @@ -84,7 +84,7 @@ Unknown argument: foo`, }); it("should print error message", async () => { - const error = await failure(requestCommand(yargs), command); + const error = await failure(requestCommand(yargs()), command); expect(error).toMatchSnapshot(); }); }); diff --git a/src/commands/aws/__tests__/__snapshots__/role.test.ts.snap b/src/commands/aws/__tests__/__snapshots__/role.test.ts.snap index 63d4bca..7a3e726 100644 --- a/src/commands/aws/__tests__/__snapshots__/role.test.ts.snap +++ b/src/commands/aws/__tests__/__snapshots__/role.test.ts.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`aws role a single installed account with Okta SAML assume should assume a role 1`] = ` +exports[`aws role a single installed account with Okta SAML assume should assume a role: stderr 1`] = ` [ [ "Execute the following commands: @@ -10,13 +10,13 @@ exports[`aws role a single installed account with Okta SAML assume should assume " Or, populate these environment variables using BASH command substitution: - $(p0 aws role assume undefined) + $(p0 aws role assume Role1) ", ], ] `; -exports[`aws role a single installed account with Okta SAML assume should assume a role 2`] = ` +exports[`aws role a single installed account with Okta SAML assume should assume a role: stdout 1`] = ` [ [ " export AWS_ACCESS_KEY_ID=test-access-key @@ -26,7 +26,7 @@ exports[`aws role a single installed account with Okta SAML assume should assume ] `; -exports[`aws role a single installed account with Okta SAML ls lists roles 1`] = ` +exports[`aws role a single installed account with Okta SAML ls lists roles: stderr 1`] = ` [ [ "Your available roles for account 1:", @@ -34,7 +34,7 @@ exports[`aws role a single installed account with Okta SAML ls lists roles 1`] = ] `; -exports[`aws role a single installed account with Okta SAML ls lists roles 2`] = ` +exports[`aws role a single installed account with Okta SAML ls lists roles: stdout 1`] = ` [ [ " Role1 diff --git a/src/commands/aws/__tests__/role.test.ts b/src/commands/aws/__tests__/role.test.ts index 053caab..64f5969 100644 --- a/src/commands/aws/__tests__/role.test.ts +++ b/src/commands/aws/__tests__/role.test.ts @@ -51,7 +51,7 @@ describe("aws role", () => { ["assume", "aws role assume Role1"], ])("%s", (_, command) => { it("should print a friendly error message", async () => { - const error = await failure(awsCommand(yargs), command); + const error = await failure(awsCommand(yargs()), command); expect(error).toMatchInlineSnapshot( `"Account 1 (test) is not configured for Okta SAML login."` ); @@ -68,17 +68,16 @@ describe("aws role", () => { }); describe("assume", () => { it("should assume a role", async () => { - await awsCommand(yargs).parse("aws role assume Role1"); - expect(mockPrint2.mock.calls).toMatchSnapshot(); - expect(mockPrint1.mock.calls).toMatchSnapshot(); + await awsCommand(yargs()).parse("aws role assume Role1"); + expect(mockPrint2.mock.calls).toMatchSnapshot("stderr"); + expect(mockPrint1.mock.calls).toMatchSnapshot("stdout"); }); }); describe("ls", () => { - const command = "aws role ls"; it("lists roles", async () => { - await awsCommand(yargs).parse(command); - expect(mockPrint2.mock.calls).toMatchSnapshot(); - expect(mockPrint1.mock.calls).toMatchSnapshot(); + await awsCommand(yargs()).parse("aws role ls"); + expect(mockPrint2.mock.calls).toMatchSnapshot("stderr"); + expect(mockPrint1.mock.calls).toMatchSnapshot("stdout"); }); }); }); diff --git a/src/commands/login.ts b/src/commands/login.ts index 51d88dd..9862680 100644 --- a/src/commands/login.ts +++ b/src/commands/login.ts @@ -12,7 +12,7 @@ import yargs from "yargs"; /** Logs in the user * * Currently only supports login to a single organization. Login credentials, together - * with organization details, are saved to ~/.p0/identity.json. + * with organization details, are saved to {@link IDENTITY_FILE_PATH}. */ export const login = async ( args: { org: string },