Skip to content

Commit

Permalink
chore: fixed tests for desktop app with team service stub
Browse files Browse the repository at this point in the history
  • Loading branch information
urz9999 committed Feb 2, 2024
1 parent 52d18ea commit 76e5e79
Show file tree
Hide file tree
Showing 22 changed files with 82 additions and 42 deletions.
2 changes: 1 addition & 1 deletion packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ $ npm install -g @noovolari/leapp-cli
$ leapp COMMAND
running command...
$ leapp (--version)
@noovolari/leapp-cli/0.1.59 darwin-x64 node-v16.14.0
@noovolari/leapp-cli/0.1.59 darwin-x64 node-v18.12.0
$ leapp --help [COMMAND]
USAGE
$ leapp COMMAND
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/scopes/help.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Display help for leapp.

Display help for leapp.

```console
```
USAGE
$ leapp help [COMMANDS] [-n]
Expand Down
8 changes: 4 additions & 4 deletions packages/cli/scopes/idp-url.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SAML 2.0 Identity providers URL management

Create a new identity provider URL

```console
```
USAGE
$ leapp idp-url create [--idpUrl <value>]
Expand All @@ -32,7 +32,7 @@ EXAMPLES

Delete an identity provider URL

```console
```
USAGE
$ leapp idp-url delete [--idpUrlId <value>] [-f]
Expand All @@ -55,7 +55,7 @@ EXAMPLES

Edit an identity provider URL

```console
```
USAGE
$ leapp idp-url edit [--idpUrlId <value>] [--idpUrl <value>]
Expand All @@ -76,7 +76,7 @@ EXAMPLES

Show identity providers list

```console
```
USAGE
$ leapp idp-url list [--columns <value> | -x] [--sort <value>] [--filter <value>] [--output csv|json|yaml | |
[--csv | --no-truncate]] [--no-header | ]
Expand Down
12 changes: 6 additions & 6 deletions packages/cli/scopes/integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Leapp Integrations management

Create a new integration

```console
```
USAGE
$ leapp integration create [--integrationAlias <value>] [--integrationPortalUrl <value>] [--integrationRegion <value>]
[--integrationType AWS-SSO|AZURE] [--integrationTenantId <value>] [--integrationLocation <value>]
Expand Down Expand Up @@ -43,7 +43,7 @@ EXAMPLES

Delete an integration

```console
```
USAGE
$ leapp integration delete [--integrationId <value>]
Expand All @@ -63,7 +63,7 @@ EXAMPLES

Show integrations list

```console
```
USAGE
$ leapp integration list [--columns <value> | -x] [--sort <value>] [--filter <value>] [--output csv|json|yaml | |
[--csv | --no-truncate]] [--no-header | ]
Expand All @@ -90,7 +90,7 @@ EXAMPLES

Login to synchronize integration sessions

```console
```
USAGE
$ leapp integration login [--integrationId <value>]
Expand All @@ -110,7 +110,7 @@ EXAMPLES

Logout from an integration

```console
```
USAGE
$ leapp integration logout [--integrationId <value>]
Expand All @@ -130,7 +130,7 @@ EXAMPLES

Synchronize integration sessions

```console
```
USAGE
$ leapp integration sync [--integrationId <value>]
Expand Down
8 changes: 4 additions & 4 deletions packages/cli/scopes/profile.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Leapp AWS Multi-profile management

Create a new AWS named profile

```console
```
USAGE
$ leapp profile create [--profileName <value>]
Expand All @@ -32,7 +32,7 @@ EXAMPLES

Delete an AWS named profile

```console
```
USAGE
$ leapp profile delete [--profileId <value>] [-f]
Expand All @@ -55,7 +55,7 @@ EXAMPLES

Rename an AWS named profile

```console
```
USAGE
$ leapp profile edit [--profileId <value>] [--profileName <value>]
Expand All @@ -76,7 +76,7 @@ EXAMPLES

Show profile list

```console
```
USAGE
$ leapp profile list [--columns <value> | -x] [--sort <value>] [--filter <value>] [--output csv|json|yaml | |
[--csv | --no-truncate]] [--no-header | ]
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/scopes/region.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Leapp regions management

Displays the default region

```console
```
USAGE
$ leapp region get-default
Expand All @@ -25,7 +25,7 @@ EXAMPLES

Change the default region

```console
```
USAGE
$ leapp region set-default [--region <value>]
Expand Down
26 changes: 13 additions & 13 deletions packages/cli/scopes/session.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Sessions management

Add a new session

```console
```
USAGE
$ leapp session add [--providerType aws] [--accessKey <value>] [--idpArn <value>] [--idpUrl <value>]
[--mfaDevice <value>] [--sessionName <value>] [--parentSessionId <value>] [--profileId <value>] [--region <value>]
Expand Down Expand Up @@ -66,7 +66,7 @@ EXAMPLES

Change a session named-profile

```console
```
USAGE
$ leapp session change-profile [--sessionId <value>] [--profileId <value>]
Expand All @@ -87,7 +87,7 @@ EXAMPLES

Change a session region

```console
```
USAGE
$ leapp session change-region [--sessionId <value>] [--region <value>]
Expand All @@ -108,7 +108,7 @@ EXAMPLES

Provides info about the current active session for a selected profile (if no profile is provided, it uses the profile default)

```console
```
USAGE
$ leapp session current [-i] [-p <value>] [-r aws|azure] [-f <value>]
Expand All @@ -133,7 +133,7 @@ EXAMPLES

Delete a session

```console
```
USAGE
$ leapp session delete [--sessionId <value>] [-f]
Expand All @@ -156,7 +156,7 @@ EXAMPLES

Generate STS temporary credentials for the given AWS session id

```console
```
USAGE
$ leapp session generate SESSIONID
Expand All @@ -174,7 +174,7 @@ EXAMPLES

Get session id

```console
```
USAGE
$ leapp session get-id
Expand All @@ -189,7 +189,7 @@ EXAMPLES

Show sessions list with all properties; filter query is case sensitive

```console
```
USAGE
$ leapp session list [--columns <value> | -x] [--sort <value>] [--filter <value>] [--output csv|json|yaml | |
[--csv | --no-truncate]] [--no-header | ]
Expand Down Expand Up @@ -228,7 +228,7 @@ EXAMPLES

Open an AWS Web Console

```console
```
USAGE
$ leapp session open-web-console [--sessionId <value>] [-p]
Expand All @@ -249,7 +249,7 @@ EXAMPLES

Run a Leapp Plugin

```console
```
USAGE
$ leapp session run-aws-credential-plugin [--sessionId <value>] [--pluginName <value>]
Expand All @@ -270,7 +270,7 @@ EXAMPLES

Start a session

```console
```
USAGE
$ leapp session start [SESSIONNAME] [--sessionId <value>] [--sessionRole <value>] [--noInteractive]
Expand Down Expand Up @@ -302,7 +302,7 @@ EXAMPLES

Start an AWS SSM session

```console
```
USAGE
$ leapp session start-ssm-session [--sessionId <value>] [--region <value>] [--ssmInstanceId <value>]
Expand All @@ -324,7 +324,7 @@ EXAMPLES

Stop a session

```console
```
USAGE
$ leapp session stop [SESSIONNAME] [--sessionId <value>] [--sessionRole <value>] [--noInteractive]
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/scopes/set-workspace.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Set the current Leapp workspace

Set the current Leapp workspace

```console
```
USAGE
$ leapp set-workspace [WORKSPACENAME]
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/scopes/team.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Login to your Team account

Login to your Team account

```console
```
USAGE
$ leapp team login
Expand All @@ -26,7 +26,7 @@ EXAMPLES

Logout from your Team account

```console
```
USAGE
$ leapp team logout
Expand All @@ -41,7 +41,7 @@ EXAMPLES

Get the team login status

```console
```
USAGE
$ leapp team status
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/scopes/version.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Displays the Cli and Core versions

Displays the Cli and Core versions

```console
```
USAGE
$ leapp version
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/scopes/workspace.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Show the current workspace

Show the current workspace

```console
```
USAGE
$ leapp workspace
Expand Down
8 changes: 8 additions & 0 deletions packages/cli/src/commands/set-workspace.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ describe("SetWorkspace", () => {
signedInUserState: {
getValue: jest.fn(),
},
getKeychainCurrentWorkspace: async () => Promise.resolve("remoteWorkspace"),
},
};
const result = await command.getWorkspaceByName("locAL");
Expand All @@ -76,6 +77,7 @@ describe("SetWorkspace", () => {
signedInUserState: {
getValue: jest.fn(() => signedInUser),
},
getKeychainCurrentWorkspace: async () => Promise.resolve("remoteWorkspace"),
},
};
const result = await command.getWorkspaceByName("Mocked-Team-Name");
Expand All @@ -91,6 +93,7 @@ describe("SetWorkspace", () => {
signedInUserState: {
getValue: () => signedInUser,
},
getKeychainCurrentWorkspace: async () => Promise.resolve("remoteWorkspace"),
},
};
await expect(command.getWorkspaceByName("wrong-mocked-team-name")).rejects.toThrow("the selected workspace does not exist");
Expand All @@ -104,6 +107,7 @@ describe("SetWorkspace", () => {
signedInUserState: {
getValue: () => signedInUser,
},
getKeychainCurrentWorkspace: async () => Promise.resolve("remoteWorkspace"),
},
};
await expect(command.getWorkspaceByName("mocked-team-name")).rejects.toThrow("the selected workspace does not exist");
Expand Down Expand Up @@ -135,6 +139,7 @@ describe("SetWorkspace", () => {
signedInUserState: {
getValue: jest.fn(() => signedInUser),
},
getKeychainCurrentWorkspace: async () => Promise.resolve("remoteWorkspace"),
},
inquirer: {
prompt: jest.fn(async () => ({ selectedWorkspace })),
Expand Down Expand Up @@ -168,6 +173,7 @@ describe("SetWorkspace", () => {
signedInUserState: {
getValue: jest.fn(() => signedInUser),
},
getKeychainCurrentWorkspace: async () => Promise.resolve("remoteWorkspace"),
},
inquirer: {
prompt: jest.fn(async () => ({ selectedWorkspace })),
Expand All @@ -184,6 +190,7 @@ describe("SetWorkspace", () => {
command.cliProviderService = {
teamService: {
switchToLocalWorkspace: jest.fn(),
getKeychainCurrentWorkspace: async () => Promise.resolve("remoteWorkspace"),
},
remoteProceduresClient: {
refreshWorkspaceState: jest.fn(),
Expand All @@ -201,6 +208,7 @@ describe("SetWorkspace", () => {
command.cliProviderService = {
teamService: {
pullFromRemote: jest.fn(),
getKeychainCurrentWorkspace: async () => Promise.resolve("remoteWorkspace"),
},
remoteProceduresClient: {
refreshWorkspaceState: jest.fn(),
Expand Down
Loading

0 comments on commit 76e5e79

Please sign in to comment.