Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More command tests #23

Merged
merged 2 commits into from
Feb 22, 2024
Merged

More command tests #23

merged 2 commits into from
Feb 22, 2024

Conversation

nbrahms
Copy link
Contributor

@nbrahms nbrahms commented Feb 21, 2024

This adds testing for all commands except SSH.

This adds testing for all commands except SSH.
Copy link
Contributor

@GGonryun GGonryun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a handful of questions to help improve my understanding of the changes.

src/commands/__tests__/login.test.ts Show resolved Hide resolved
try {
await spec.fail((_, err) => (error = err)).parse(command);
} catch (thrown: any) {
error = thrown;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could this function only returning the thrown error in the catch block instead of defining let error: any at the top?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because the main throw path is via line 6 (TBH one could probably just remove the try / catch altogether; I'll investigate)

/** Logs in the user
*
* Currently only supports login to a single organization. Login credentials, together
* with organization details, are saved to ~/.p0/identity.json.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: should we mention that the file path is determined by the variable: IDENTITY_FILE_PATH instead of a hard coded path?

});
});
});
describe("with Okta SAML", () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that we're missing a test here to verify the error No roles found. You have roles on these accounts... which is thrown when we're trying to list roles but the user doesn't have any.

throw `No roles found. You have roles on these accounts:\n${accounts.join(

We can probably add it later, wdyt?

@nbrahms nbrahms merged commit 3b734ad into main Feb 22, 2024
2 checks passed
@nbrahms nbrahms deleted the nathan/more-tests branch February 22, 2024 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants