Skip to content

Commit

Permalink
fix: team unit test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
cs-raj committed Nov 9, 2023
1 parent ffdecee commit c0b90a3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
{
"uid": "test-uid-2",
"name": "test org 2"
},
{
"uid": "org_uid_1_teams",
"name": "Teams Org"
}
],
"stacks": [
Expand Down Expand Up @@ -102,6 +106,25 @@
{
"uid": "test-uid-2",
"name": "test org 2"
},
{
"organizations": [
{
"uid": "org_uid_1_teams",
"name": "Teams Org",
"org_roles": [
{
"uid": "role1",
"name": "Admin",
"description": "Admin Role",
"org_uid": "test-uid-1",
"admin": true,
"default": true
}
]
}
]

}
],
"roles": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,32 +409,4 @@ describe('Testing the teams support in cli export-to-csv', () => {
.command(['cm:export-to-csv'])
.it('CSV file should be created');
});

describe('Testing Teams Command with prompt and no stack role data', () => {
test
.stdout({ print: process.env.PRINT === 'true' || false })
.stub(fs, 'createWriteStream', () => new PassThrough())
.stub(mkdirp, 'sync', () => {})
.stub(process, 'chdir', () => {})
.stub(inquirer, 'registerPrompt', () => {})
.stub(inquirer, 'prompt', () => {
return Promise.resolve({ action: 'teams', chosenOrg: mockData.organizations[2].name, chooseExport: 'no' });
})
.nock(cma, (api) => {
api.get('/v3/user?include_orgs_roles=true').reply(200, { user: mockData.users[2] });
})
.nock(cma, (api) => {
api
.get(`/organizations/org_uid_1_teams/teams?skip=0&limit=100&includeUserDetails=true`)
.reply(200, mockData.Teams.allTeams);
})
.nock(cma, (api) => {
api.get(`/v3/organizations/org_uid_1_teams/roles`).reply(200, mockData.org_roles);
})
.nock(cma, (api) => {
api.get(`/v3/roles`).reply(200, { roles: {} });
})
.command(['cm:export-to-csv'])
.it('No CSV file should be created');
});
});

0 comments on commit c0b90a3

Please sign in to comment.