Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rix0rrr committed Apr 5, 2022
1 parent 6436056 commit ad572e8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
4 changes: 3 additions & 1 deletion packages/aws-cdk/test/cdk-toolkit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,9 @@ describe('synth', () => {
const toolkit = defaultToolkitSetup();
await toolkit.synth([], false, false);

expect(stderrMock.mock.calls[1][0]).toMatch('Test-Stack-A-Display-Name, Test-Stack-B');
// Separate tests as colorizing hampers detection
expect(stderrMock.mock.calls[1][0]).toMatch('Test-Stack-A-Display-Name');
expect(stderrMock.mock.calls[1][0]).toMatch('Test-Stack-B');
});

test('with no stdout option', async () => {
Expand Down
16 changes: 8 additions & 8 deletions packages/aws-cdk/test/import.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ test('discovers importable resources', async () => {
});

const importer = new ResourceImporter(STACK_WITH_QUEUE, deployments);
const resources = await importer.discoverImportableResources();
expect(resources).toEqual([
const { additions } = await importer.discoverImportableResources();
expect(additions).toEqual([
expect.objectContaining({
logicalId: 'MyQueue',
}),
Expand All @@ -86,11 +86,11 @@ test('asks human for resource identifiers', async () => {
// GIVEN
givenCurrentStack(STACK_WITH_QUEUE.stackName, { Resources: {} });
const importer = new ResourceImporter(STACK_WITH_QUEUE, deployments);
const resources = await importer.discoverImportableResources();
const { additions } = await importer.discoverImportableResources();

// WHEN
promptlyPrompt.mockResolvedValue('TheQueueName');
const importable = await importer.askForResourceIdentifiers(resources);
const importable = await importer.askForResourceIdentifiers(additions);

// THEN
expect(importable.resourceMap).toEqual({
Expand All @@ -109,11 +109,11 @@ test('asks human to confirm automic import if identifier is in template', async
// GIVEN
givenCurrentStack(STACK_WITH_NAMED_QUEUE.stackName, { Resources: {} });
const importer = new ResourceImporter(STACK_WITH_NAMED_QUEUE, deployments);
const resources = await importer.discoverImportableResources();
const { additions } = await importer.discoverImportableResources();

// WHEN
promptlyConfirm.mockResolvedValue(true);
const importable = await importer.askForResourceIdentifiers(resources);
const importable = await importer.askForResourceIdentifiers(additions);

// THEN
expect(importable.resourceMap).toEqual({
Expand All @@ -132,9 +132,9 @@ test('asks human to confirm automic import if identifier is in template', async
// GIVEN
givenCurrentStack(STACK_WITH_QUEUE.stackName, { Resources: {} });
const importer = new ResourceImporter(STACK_WITH_QUEUE, deployments);
const resources = await importer.discoverImportableResources();
const { additions } = await importer.discoverImportableResources();
const importMap: ImportMap = {
importResources: resources,
importResources: additions,
resourceMap: {
MyQueue: { QueueName: 'TheQueueName' },
},
Expand Down

0 comments on commit ad572e8

Please sign in to comment.