forked from aws-amplify/amplify-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(cli): add test for get-userpoolgroup-list.ts (aws-amplify#7227)
This commit adds a test for get-userpoolgroup-list.ts
- Loading branch information
1 parent
edd1ac3
commit bbb16fc
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
packages/amplify-cli/src/__tests__/extensions/amplify-helpers/get-userpoolgroup-list.test.ts
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,43 @@ | ||
import { getUserPoolGroupList } from '../../../extensions/amplify-helpers/get-userpoolgroup-list'; | ||
|
||
jest.mock('amplify-cli-core', () => ({ | ||
pathManager: { | ||
getBackendDirPath: jest.fn().mockImplementation(() => ''), | ||
}, | ||
JSONUtilities: { | ||
readJson: jest.fn().mockImplementation(() => [ | ||
{ | ||
groupName: 'Admins', | ||
precedence: 1, | ||
customPolicies: [ | ||
{ | ||
PolicyName: 'admin-group-policy', | ||
PolicyDocument: { | ||
Version: '2012-10-17', | ||
Statement: [ | ||
{ | ||
Sid: 'statement1', | ||
Effect: 'Allow', | ||
Action: ['s3:CreateBucket'], | ||
Resource: ['arn:aws:s3:::*'], | ||
}, | ||
], | ||
}, | ||
}, | ||
], | ||
}, | ||
{ | ||
groupName: 'Editors', | ||
precedence: 2, | ||
}, | ||
]), | ||
}, | ||
})); | ||
|
||
describe('getUserPoolGroupList', () => { | ||
const mock_context = {}; | ||
it('should return array of groupNames', () => { | ||
const userPoolGroupList = getUserPoolGroupList(mock_context); | ||
expect(userPoolGroupList).toStrictEqual(['Admins', 'Editors']); | ||
}); | ||
}); |