|
1 | 1 | import { testDeprecated } from '@aws-cdk/cdk-build-tools';
|
2 |
| -import * as cxapi from '../../cx-api'; |
3 |
| -import { Fact, RegionInfo } from '../../region-info'; |
4 | 2 | import { Construct, Node } from 'constructs';
|
5 | 3 | import { toCloudFormation } from './util';
|
| 4 | +import * as cxapi from '../../cx-api'; |
| 5 | +import { Fact, RegionInfo } from '../../region-info'; |
6 | 6 | import {
|
7 | 7 | App, CfnCondition, CfnInclude, CfnOutput, CfnParameter,
|
8 | 8 | CfnResource, Lazy, ScopedAws, Stack, validateString,
|
@@ -2071,6 +2071,40 @@ describe('stack', () => {
|
2071 | 2071 | stack.node.setContext(cxapi.BUNDLING_STACKS, []);
|
2072 | 2072 | expect(stack.bundlingRequired).toBe(false);
|
2073 | 2073 | });
|
| 2074 | + |
| 2075 | + test('account id passed in stack environment must be a string', () => { |
| 2076 | + // GIVEN |
| 2077 | + const envConfig: any = { |
| 2078 | + account: 11111111111, |
| 2079 | + }; |
| 2080 | + |
| 2081 | + // WHEN |
| 2082 | + const app = new App(); |
| 2083 | + |
| 2084 | + // THEN |
| 2085 | + expect(() => { |
| 2086 | + new Stack(app, 'Stack', { |
| 2087 | + env: envConfig, |
| 2088 | + }); |
| 2089 | + }).toThrowError('Account id of stack environment must be a \'string\' but received \'number\''); |
| 2090 | + }); |
| 2091 | + |
| 2092 | + test('region passed in stack environment must be a string', () => { |
| 2093 | + // GIVEN |
| 2094 | + const envConfig: any = { |
| 2095 | + region: 2, |
| 2096 | + }; |
| 2097 | + |
| 2098 | + // WHEN |
| 2099 | + const app = new App(); |
| 2100 | + |
| 2101 | + // THEN |
| 2102 | + expect(() => { |
| 2103 | + new Stack(app, 'Stack', { |
| 2104 | + env: envConfig, |
| 2105 | + }); |
| 2106 | + }).toThrowError('Region of stack environment must be a \'string\' but received \'number\''); |
| 2107 | + }); |
2074 | 2108 | });
|
2075 | 2109 |
|
2076 | 2110 | describe('permissions boundary', () => {
|
|
0 commit comments