|
1 | 1 | /* eslint-disable @typescript-eslint/unbound-method */ |
2 | 2 | import { HotswapMode } from '@aws-cdk/cdk-cli-wrapper'; |
3 | | -import { Toolkit } from '@aws-cdk/toolkit-lib'; |
| 3 | +import { Toolkit, BaseCredentials } from '@aws-cdk/toolkit-lib'; |
4 | 4 | import { ToolkitLibRunnerEngine } from '../../lib/engines/toolkit-lib'; |
5 | 5 |
|
6 | 6 | jest.mock('@aws-cdk/toolkit-lib'); |
7 | 7 |
|
8 | 8 | const MockedToolkit = Toolkit as jest.MockedClass<typeof Toolkit>; |
| 9 | +const MockedBaseCredentials = BaseCredentials as jest.Mocked<typeof BaseCredentials>; |
9 | 10 |
|
10 | 11 | describe('ToolkitLibRunnerEngine', () => { |
11 | 12 | let mockToolkit: jest.Mocked<Toolkit>; |
@@ -230,6 +231,21 @@ describe('ToolkitLibRunnerEngine', () => { |
230 | 231 | })); |
231 | 232 | }); |
232 | 233 |
|
| 234 | + it('should pass profile to BaseCredentials', () => { |
| 235 | + MockedBaseCredentials.awsCliCompatible = jest.fn(); |
| 236 | + |
| 237 | + new ToolkitLibRunnerEngine({ |
| 238 | + workingDirectory: '/test', |
| 239 | + region: 'us-dummy-1', |
| 240 | + profile: 'test-profile', |
| 241 | + }); |
| 242 | + |
| 243 | + expect(MockedBaseCredentials.awsCliCompatible).toHaveBeenCalledWith({ |
| 244 | + profile: 'test-profile', |
| 245 | + defaultRegion: 'us-dummy-1', |
| 246 | + }); |
| 247 | + }); |
| 248 | + |
233 | 249 | it('should throw error when no app is provided', async () => { |
234 | 250 | await expect(engine.synth({} as any)).rejects.toThrow('No app provided'); |
235 | 251 | }); |
|
0 commit comments