|
1 | 1 | /* eslint-disable import/order */
|
2 | 2 | import { Command, Context, Settings } from '../lib/settings';
|
| 3 | +import { Tag } from '../lib/cdk-toolkit'; |
3 | 4 |
|
4 | 5 | test('can delete values from Context object', () => {
|
5 | 6 | // GIVEN
|
@@ -81,6 +82,26 @@ test('can parse string context from command line arguments with equals sign in v
|
81 | 82 | expect(settings2.get(['context']).foo).toEqual( 'bar=');
|
82 | 83 | });
|
83 | 84 |
|
| 85 | +test('can parse tag values from command line arguments', () => { |
| 86 | + // GIVEN |
| 87 | + const settings1 = Settings.fromCommandLineArguments({ tags: ['foo=bar'], _: [Command.DEPLOY] }); |
| 88 | + const settings2 = Settings.fromCommandLineArguments({ tags: ['foo='], _: [Command.DEPLOY] }); |
| 89 | + |
| 90 | + // THEN |
| 91 | + expect(settings1.get(['tags']).find((tag: Tag) => tag.Key === 'foo').Value).toEqual('bar'); |
| 92 | + expect(settings2.get(['tags']).find((tag: Tag) => tag.Key === 'foo').Value).toEqual(''); |
| 93 | +}); |
| 94 | + |
| 95 | +test('can parse tag values from command line arguments with equals sign in value', () => { |
| 96 | + // GIVEN |
| 97 | + const settings1 = Settings.fromCommandLineArguments({ tags: ['foo==bar='], _: [Command.DEPLOY] }); |
| 98 | + const settings2 = Settings.fromCommandLineArguments({ tags: ['foo=bar='], _: [Command.DEPLOY] }); |
| 99 | + |
| 100 | + // THEN |
| 101 | + expect(settings1.get(['tags']).find((tag: Tag) => tag.Key === 'foo').Value).toEqual('=bar='); |
| 102 | + expect(settings2.get(['tags']).find((tag: Tag) => tag.Key === 'foo').Value).toEqual('bar='); |
| 103 | +}); |
| 104 | + |
84 | 105 | test('bundling stacks defaults to an empty list', () => {
|
85 | 106 | // GIVEN
|
86 | 107 | const settings = Settings.fromCommandLineArguments({
|
|
0 commit comments