Skip to content

Commit

Permalink
Serialise RolePrincipal (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
tdpauw committed Aug 21, 2024
1 parent d526194 commit e409dcb
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/principals/serialiser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
AccountPrincipal,
ArnPrincipal,
UserPrincipal,
RolePrincipal,
Principal,
ServicePrincipal,
FederatedPrincipal,
Expand Down Expand Up @@ -38,6 +39,16 @@ describe('#PrincipalJSONSerialiser', function() {
});
});

describe('when having one IAM Role as AWS principal', function() {
const accountId = '012345678900';
const userName ='aUser';
const arn = `arn:aws:iam::${accountId}:role/${userName}`;
const principals = [new RolePrincipal(accountId, userName)];
it('should return a JSON object having an AWS property having one string', function() {
expect(PrincipalJSONSerialiser.toJSON(principals)).to.deep.equal({AWS: arn});
});
});

describe('when having one Service principal', function() {
const service = 'aservice.amazonaws.com';
const principals = [new ServicePrincipal(service)];
Expand Down

0 comments on commit e409dcb

Please sign in to comment.