Skip to content

Commit 194fea1

Browse files
Slashekgodot
andauthored
fix test (#667)
* fix test * fix data.test.js * update tests * push * Update deploy.test.js * Update waitForStatus.js --------- Co-authored-by: dariusz gorzeba <[email protected]>
1 parent d8ca013 commit 194fea1

File tree

4 files changed

+9
-15
lines changed

4 files changed

+9
-15
lines changed

lib/data/waitForStatus.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const logger = require('../logger');
22

3-
const waitForStatus = (statusCheck, pendingStatus, successStatus, interval = 1500, cb = null) => {
3+
const waitForStatus = (statusCheck, pendingStatus, successStatus, interval = 5000, cb = null) => {
44
return new Promise((resolve, reject) => {
55
(getStatus = () => {
66
statusCheck()

test/data.test.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,6 @@ describe('Data clean', () => {
1616
});
1717
});
1818

19-
describe('Data clean real', () => {
20-
test('shows message when wrong confirmation passed inline', async () => {
21-
const {code, stderr, stdout} = await exec(`echo "CLEAN DATA" | ${cliPath} data clean`, { env });
22-
expect(stderr).toMatch('WARNING!!! You are going to REMOVE your data from instance: http://example.com')
23-
expect(stderr).toMatch('There is no coming back.')
24-
expect(stderr).toMatch('"statusCode": 405')
25-
expect(stderr).toMatch('"pathname": "/api/app_builder/data_clean"')
26-
expect(stderr).toMatch(env.MPKIT_URL)
27-
});
28-
});
29-
3019
describe('Data import', () => {
3120
test('should show message when wrong file for data import', async () => {
3221
const {code, stderr} = await exec(`echo "wrong confirm" | ${cliPath} data import foo -p ./test/fixtures/wrong_json.json`, { env });

test/deploy.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const extract = async (inputPath, outputPath) => {
1616
return unzip.Open.file(inputPath).then(d => d.extract({ path: outputPath, concurrency: 5 }));
1717
};
1818

19-
jest.setTimeout(20000); // default jasmine timeout is 5 seconds - we need more.
19+
jest.setTimeout(40000); // default jasmine timeout is 5 seconds - we need more.
2020

2121
describe('Happy path', () => {
2222
test('App directory + modules', async () => {
@@ -117,13 +117,13 @@ describe('Server errors', () => {
117117
});
118118

119119
test('Network error and pos-cli exits with 1', async () => {
120-
process.env.MPKIT_URL = 'https://incorrecturl.com'
120+
process.env.MPKIT_URL = 'https://incorrecturl123xyz.com'
121121

122122
const { stderr, stdout, code } = await run('correct');
123123

124124
expect(code).toEqual(1);
125125
expect(stderr).toMatch(
126-
'Deploy failed. RequestError: Error: getaddrinfo ENOTFOUND incorrecturl.com'
126+
'Deploy failed. RequestError: Error: getaddrinfo ENOTFOUND incorrecturl123xyz.com'
127127
);
128128
});
129129
});

test/modules-push.test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ const path = require('path');
77

88
require('dotenv').config();
99

10+
Object.assign(process.env, {
11+
DEBUG: true
12+
});
13+
1014
const cwd = name => path.join(process.cwd(), 'test', 'fixtures', 'modules', name);
1115

1216
const run = (fixtureName, options) => exec(`${cliPath} modules push ${options}`, { cwd: cwd(fixtureName), env: process.env });
@@ -39,6 +43,7 @@ describe('Server errors', () => {
3943

4044
test('Wrong email', async () => {
4145
const { stdout, stderr } = await run('good', '--email [email protected]');
46+
expect(stderr).toMatch('Cannot find modules/pos_cli_ci_test, creating archive with the current directory');
4247
expect(stderr).toMatch('You are unauthorized to do this operation. Check if your Token/URL or email/password are correct.');
4348
});
4449

0 commit comments

Comments
 (0)