-
Notifications
You must be signed in to change notification settings - Fork 2
/
script_get_cert.test.js
49 lines (43 loc) · 2.01 KB
/
script_get_cert.test.js
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
/* eslint-disable no-console */
import { jest, test, expect, describe } from '@jest/globals';
import getScript from '../lib/cmd/getscript.js';
const options = {
logLevel: process.env.CTRL_Q_LOG_LEVEL || 'info',
authType: process.env.CTRL_Q_AUTH_TYPE || 'cert',
authCertFile: process.env.CTRL_Q_AUTH_CERT_FILE || './cert/client.pem',
authCertKeyFile: process.env.CTRL_Q_AUTH_CERT_KEY_FILE || './cert/client_key.pem',
authRootCertFile: process.env.CTRL_Q_AUTH_ROOT_CERT_FILE || './cert/root.pem',
host: process.env.CTRL_Q_HOST || '',
port: process.env.CTRL_Q_PORT || '4747',
virtualProxy: process.env.CTRL_Q_VIRTUAL_PROXY || '',
secure: process.env.CTRL_Q_SECURE || true,
schemaVersion: process.env.CTRL_Q_SCHEMA_VERSION || '12.612.0',
appId: process.env.CTRL_Q_APP_ID || 'a3e0f5d2-000a-464f-998d-33d333b175d7',
authUserDir: process.env.CTRL_Q_AUTH_USER_DIR || '',
authUserId: process.env.CTRL_Q_AUTH_USER_ID || '',
};
const defaultTestTimeout = process.env.CTRL_Q_TEST_TIMEOUT || 120000; // 2 minute default timeout
console.log(`Jest timeout: ${defaultTestTimeout}`);
jest.setTimeout(defaultTestTimeout);
// Get app script
describe('get app script (cert auth)', () => {
test('Verify parameters', async () => {
expect(options.authCertFile).not.toHaveLength(0);
expect(options.authCertKeyFile).not.toHaveLength(0);
expect(options.authRootCertFile).not.toHaveLength(0);
expect(options.host).not.toHaveLength(0);
expect(options.authUserDir).not.toHaveLength(0);
expect(options.authUserId).not.toHaveLength(0);
});
/**
* Get app script
* Should succeed
*/
test('get app script', async () => {
const result = await getScript(options);
expect(result.appId).toBe('a3e0f5d2-000a-464f-998d-33d333b175d7');
expect(result.appCreatedDate).toBe('2021-06-03T22:04:52.283Z');
expect(result.appModifiedDate).toBe('2023-05-05T06:17:05.456Z');
expect(result.appScript.length).toBe(1989);
});
});