Skip to content

Commit

Permalink
fix(executor): fix generateContents method (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
tapesec authored Oct 12, 2022
1 parent c1ebea3 commit 29299f2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/lib/Components/Executors/exports/DockerExecutor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ export class DockerExecutor extends Executor {
*/
generateContents(): DockerExecutorContentsShape {
const imagesArray: DockerImage[] = [this.image];
imagesArray.concat(this.serviceImages);

return imagesArray;
return imagesArray.concat(this.serviceImages);
}

get generableType(): GenerableType {
Expand Down
24 changes: 24 additions & 0 deletions tests/Executor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,30 @@ describe('Instantiate Docker Executor', () => {
expect(docker instanceof CircleCI.executors.Executor).toBeTruthy();
});

const dockerWithMultipleImage = new CircleCI.executors.DockerExecutor(
'cimg/node:lts',
);
dockerWithMultipleImage.addServiceImage({
image: 'cimg/mysql:5.7',
});
const expectedShapeWithMultipleImage = {
docker: [
{
image: 'cimg/node:lts',
},
{
image: 'cimg/mysql:5.7',
},
],
resource_class: 'medium',
};

it('Should match the expected outputh with two images', () => {
expect(dockerWithMultipleImage.generate()).toEqual(
expectedShapeWithMultipleImage,
);
});

const reusableExecutor = new CircleCI.reusable.ReusableExecutor(
'default',
docker,
Expand Down

0 comments on commit 29299f2

Please sign in to comment.