Skip to content

Commit 8ff78ab

Browse files
committed
test(integ-runner): add test for profile option in toolkit-lib engine
1 parent a536cb3 commit 8ff78ab

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

packages/@aws-cdk/integ-runner/test/engines/toolkit-lib.test.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
/* eslint-disable @typescript-eslint/unbound-method */
22
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';
44
import { ToolkitLibRunnerEngine } from '../../lib/engines/toolkit-lib';
55

66
jest.mock('@aws-cdk/toolkit-lib');
77

88
const MockedToolkit = Toolkit as jest.MockedClass<typeof Toolkit>;
9+
const MockedBaseCredentials = BaseCredentials as jest.Mocked<typeof BaseCredentials>;
910

1011
describe('ToolkitLibRunnerEngine', () => {
1112
let mockToolkit: jest.Mocked<Toolkit>;
@@ -230,6 +231,21 @@ describe('ToolkitLibRunnerEngine', () => {
230231
}));
231232
});
232233

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+
233249
it('should throw error when no app is provided', async () => {
234250
await expect(engine.synth({} as any)).rejects.toThrow('No app provided');
235251
});

0 commit comments

Comments
 (0)