UNPKG

4.72 kBJavaScriptView Raw
1var sh = require('shelljs');
2var silentState = sh.config.silent; // save old silent state
3
4test('should return error for missing command on stdout', () => {
5 sh.config.silent = true;
6 let command = sh.exec('./marketplace-kit.js missing');
7 expect(command.stderr).toEqual(expect.stringContaining('unknown command: missing'));
8 sh.config.silent = silentState;
9});
10
11test('should show help on stdout', () => {
12 sh.config.silent = true;
13 let command = sh.exec('./marketplace-kit.js help');
14 expect(command.stdout).toEqual(expect.stringContaining('Usage: marketplace-kit'));
15 sh.config.silent = silentState;
16});
17
18
19test('should run help on deploy', () => {
20 sh.config.silent = true;
21 let command = sh.exec('./marketplace-kit.js deploy');
22 expect(command.code).toEqual(0);
23 expect(command.stdout).toEqual(expect.stringContaining('Usage: marketplace-kit-deploy [options] [environment]'));
24 sh.config.silent = silentState;
25});
26
27test('should run help on data import', () => {
28 sh.config.silent = true;
29 let command = sh.exec('./marketplace-kit.js data import');
30 expect(command.code).toEqual(0);
31 expect(command.stdout).toEqual(expect.stringContaining('Usage: marketplace-kit-data-import [options] [environment]'));
32 sh.config.silent = silentState;
33});
34
35test('should run help on data update', () => {
36 sh.config.silent = true;
37 let command = sh.exec('./marketplace-kit.js data update');
38 expect(command.code).toEqual(0);
39 expect(command.stdout).toEqual(expect.stringContaining('Usage: marketplace-kit-data-update [options] [environment]'));
40 sh.config.silent = silentState;
41});
42
43test('should run help on data export', () => {
44 sh.config.silent = true;
45 let command = sh.exec('./marketplace-kit.js data export');
46 expect(command.code).toEqual(0);
47 expect(command.stdout).toEqual(expect.stringContaining('Usage: marketplace-kit-data-export [options] [environment]'));
48 sh.config.silent = silentState;
49});
50
51test('should run env list', () => {
52 sh.config.silent = true;
53 let command = sh.exec('./marketplace-kit.js env list');
54 expect(command.code).toEqual(1);
55 expect(command.stderr).toEqual(expect.stringContaining('No environments registered yet, please see marketplace-kit env add'));
56 sh.config.silent = silentState;
57});
58
59test('should run help on env add', () => {
60 sh.config.silent = true;
61 let command = sh.exec('./marketplace-kit.js env add');
62 expect(command.code).toEqual(0);
63 expect(command.stdout).toEqual(expect.stringContaining('Usage: marketplace-kit-env-add [options] [environment]'));
64 sh.config.silent = silentState;
65});
66
67test('should run audit', () => {
68 sh.config.silent = true;
69 let command = sh.exec('./marketplace-kit.js audit');
70 expect(command.code).toEqual(0);
71 sh.config.silent = silentState;
72});
73
74test('should run help on gui serve', () => {
75 sh.config.silent = true;
76 let command = sh.exec('./marketplace-kit.js gui serve');
77 expect(command.code).toEqual(0);
78 expect(command.stdout).toEqual(expect.stringContaining('Usage: marketplace-kit-gui-serve [options] [environment]'));
79 sh.config.silent = silentState;
80});
81
82test('should run help on logs', () => {
83 sh.config.silent = true;
84
85 let command = sh.exec('./marketplace-kit.js logs');
86 expect(command.code).toEqual(0);
87 expect(command.stdout).toEqual(expect.stringContaining('Usage: marketplace-kit-logs [options] [environment]'));
88 sh.config.silent = silentState;
89});
90
91test('should run help on migrations run', () => {
92 sh.config.silent = true;
93 let command = sh.exec('./marketplace-kit.js migrations run');
94 expect(command.code).toEqual(0);
95 expect(command.stdout).toEqual(expect.stringContaining('Usage: marketplace-kit-migrations-run [options] [environment]'));
96 sh.config.silent = silentState;
97});
98
99test('should run help on migrations list', () => {
100 sh.config.silent = true;
101 let command = sh.exec('./marketplace-kit.js migrations list');
102 expect(command.code).toEqual(0);
103 expect(command.stdout).toEqual(expect.stringContaining('Usage: marketplace-kit-migrations-list [options] [environment]'));
104 sh.config.silent = silentState;
105});
106
107test('should run help on modules list', () => {
108 sh.config.silent = true;
109 let command = sh.exec('./marketplace-kit.js modules list');
110 expect(command.code).toEqual(0);
111 expect(command.stdout).toEqual(expect.stringContaining('Usage: marketplace-kit-modules-list [options] [environment]'));
112 sh.config.silent = silentState;
113});
114
115test('should run help on sync', () => {
116 sh.config.silent = true;
117
118 let command = sh.exec('./marketplace-kit.js sync');
119 expect(command.code).toEqual(0);
120 expect(command.stdout).toEqual(expect.stringContaining('Usage: marketplace-kit-sync [options] [environment]'));
121 sh.config.silent = silentState;
122});