Skip to content

Commit d6c0740

Browse files
committed
code styling update
1 parent 58897b9 commit d6c0740

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

test/helper-docker.js

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,68 @@
1-
"use strict";
2-
const Docker = require("dockerode");
1+
'use strict'
2+
const Docker = require('dockerode')
33

44
const Containers = {
55
mongo: {
6-
name: "fastify-mongo",
7-
Image: "mongo:7",
6+
name: 'fastify-mongo',
7+
Image: 'mongo:7',
88
Tty: false,
99
HostConfig: {
1010
PortBindings: {
11-
"27017/tcp": [{ HostIp: "0.0.0.0", HostPort: "27017" }],
11+
'27017/tcp': [{ HostIp: '0.0.0.0', HostPort: '27017' }],
1212
},
1313
AutoRemove: true,
1414
},
1515
},
16-
};
16+
}
1717

1818
function dockerConsole() {
19-
const docker = new Docker();
19+
const docker = new Docker()
2020
async function pullImage(container) {
2121
return new Promise((resolve, reject) => {
2222
docker.pull(container.Image, (err, stream) => {
2323
if (err) {
24-
reject(err);
25-
return;
24+
reject(err)
25+
return
2626
}
27-
docker.modem.followProgress(stream, onFinished, onProgress);
28-
});
27+
docker.modem.followProgress(stream, onFinished, onProgress)
28+
})
2929
function onFinished(err, output) {
3030
if (err) {
31-
reject(err);
32-
return;
31+
reject(err)
32+
return
3333
}
34-
resolve(output);
34+
resolve(output)
3535
}
3636
function onProgress(event) {
37-
console.log(event);
37+
console.log(event)
3838
}
39-
});
39+
})
4040
}
4141
return {
4242
async getRunningContainer(container) {
43-
const containers = await docker.listContainers();
43+
const containers = await docker.listContainers()
4444
return containers.find((running) => {
45-
return running.Names.some((name) => name.includes(container.name));
46-
});
45+
return running.Names.some((name) => name.includes(container.name))
46+
})
4747
},
4848
async startContainer(container) {
49-
const run = await this.getRunningContainer(container);
49+
const run = await this.getRunningContainer(container)
5050
if (!run) {
51-
await pullImage(container);
52-
const containerObj = await docker.createContainer(container);
53-
await containerObj.start();
51+
await pullImage(container)
52+
const containerObj = await docker.createContainer(container)
53+
await containerObj.start()
5454
}
5555
},
5656
async stopContainer(container) {
57-
const run = await this.getRunningContainer(container);
57+
const run = await this.getRunningContainer(container)
5858
if (run) {
59-
const containerObj = await docker.getContainer(run.Id);
60-
await containerObj.stop();
59+
const containerObj = await docker.getContainer(run.Id)
60+
await containerObj.stop()
6161
}
6262
},
6363
pullImage,
64-
};
64+
}
6565
}
6666

67-
module.exports = dockerConsole;
68-
module.exports.Containers = Containers;
67+
module.exports = dockerConsole
68+
module.exports.Containers = Containers

0 commit comments

Comments
 (0)