-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
types support for stackRoleMapping and test cases
- Loading branch information
1 parent
e85be9f
commit 0aa565d
Showing
4 changed files
with
63 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { expect } from "chai"; | ||
import { Organization } from "../../types/organization"; | ||
|
||
let teamUid = 'teamUid' | ||
let stackApiKey = 'stackApiKey' | ||
export function testTeamStackRoleMapping (organization: Organization) { | ||
describe('Contentstack Teams Stack Role Mapping test', () => { | ||
it('should fetch all stackRoleMappings', done => { | ||
organization.teams(teamUid).stackRoleMappings().fetchAll().then((response) => { | ||
expect(response).to.be.not.equal(undefined) | ||
done() | ||
}) | ||
.catch(done) | ||
}) | ||
it('should add roles', done => { | ||
const stackRoleMappings = { | ||
stackApiKey: 'stackApiKey', | ||
roles: [ | ||
'role_uid' | ||
] | ||
} | ||
organization.teams(teamUid).stackRoleMappings(stackApiKey).add(stackRoleMappings).then((response) => { | ||
expect(response.stackRoleMapping).not.to.be.equal(undefined) | ||
expect(response.stackRoleMapping.roles[0]).to.be.equal(stackRoleMappings.roles[0]) | ||
expect(response.stackRoleMapping.stackApiKey).to.be.equal(stackRoleMappings.stackApiKey) | ||
done() | ||
}) | ||
.catch(done) | ||
}) | ||
it('should update roles', done => { | ||
const stackRoleMappings = { | ||
roles: [ | ||
'role_uid1', | ||
'role_uid2' | ||
] | ||
} | ||
organization.teams(teamUid).stackRoleMappings(stackApiKey).update(stackRoleMappings).then((response) => { | ||
expect(response).not.to.be.equal(undefined) | ||
expect(response.StackRoleMappingData.roles[0]).to.be.equal(stackRoleMappings.roles[0]) | ||
expect(response.StackRoleMappingData.stackApiKey).to.be.equal(stackApiKey) | ||
done() | ||
}) | ||
.catch(done) | ||
}) | ||
it('should delete roles', done => { | ||
organization.teams(teamUid).stackRoleMappings(stackApiKey).delete().then((response) => { | ||
expect(response.status).to.be.equal(204) | ||
done() | ||
}) | ||
.catch(done) | ||
}) | ||
}) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters