-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathindex.test.js
More file actions
55 lines (40 loc) · 1.9 KB
/
index.test.js
File metadata and controls
55 lines (40 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
const app = require('./app');
let inputs = {
'email': 'test@test.com',
'api_key': 'test',
'heroku_apps': '[{"imagename":"app1","appname":"app3","apptype":"web"},{"imagename":"app2","appname":"app2","apptype":"web"},{"imagename":"app3","appname":"app2","apptype":"worker"}]',
'docker_compose_file': './src/docker-compose-heroku.yml'
};
jest.mock('util', () => ({
promisify: jest.fn(() => {
return jest.fn();
})
}));
test('build and deploy with 3 images', async () => {
await app.buildAndDeploy(inputs.email, inputs.api_key, inputs.docker_compose_file, inputs.heroku_apps);
});
test('build and deploy with single image', async () => {
await app.buildAndDeploy(inputs.email, inputs.api_key, inputs.docker_compose_file, '[{"imagename":"app1","appname":"app3","apptype":"web"}]');
});
test('get image string to json object', async () => {
const imageString = '[{"imagename":"app1","appname":"app3","apptype":"web"},{"imagename":"app2","appname":"app2","apptype":"web"},{"imagename":"app3","appname":"app2","apptype":"worker"}]';
var images = await app.getImageAppNameList(imageString);
expect(images.length).toBeGreaterThan(0);
expect(images[0].appname).toBe('app3');
expect(images.length).toBe(3);
});
test('get image string to json object for single element', async () => {
const imageString = '[{"imagename":"app1","appname":"app3","apptype":"web"}]';
var images = await app.getImageAppNameList(imageString);
expect(images.length).toBeGreaterThan(0);
expect(images[0].appname).toBe('app3');
expect(images.length).toBe(1);
});
test('check execution times', async () => {
const images = JSON.parse('[{"imagename":"app1","appname":"app3","apptype":"web"}]');
await app.pushAndDeployAllImages(images);
});
test('check build docker compose', async () => {
const path = './src/docker-compose.yml';
await app.buildDockerCompose(path);
});