@verii/data-loader 1.0.0-pre.1756096826 → 1.0.0-pre.1756224043
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -5
- package/test/batch-issuing.test.js +5 -60
- package/test/vendor-credentials.test.js +3 -0
- package/jest.config.js +0 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verii/data-loader",
|
|
3
|
-
"version": "1.0.0-pre.
|
|
3
|
+
"version": "1.0.0-pre.1756224043",
|
|
4
4
|
"description": "A tool for uploading data to the different target systems.",
|
|
5
5
|
"repository": "https://github.com/LFDT-Verii/core",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
"data-loader": "src/index.js"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
-
"test": "
|
|
12
|
-
"lint": "eslint
|
|
11
|
+
"test": "cross-env NODE_ENV=test node --test --test-concurrency=1 --experimental-test-module-mocks --experimental-test-coverage **/*.test.js --passWithNoTests",
|
|
12
|
+
"lint": "eslint --ext .js .",
|
|
13
|
+
"lint:ci": "eslint . --format json >> eslint-results.json",
|
|
13
14
|
"lint:fix": "eslint --fix --ext .js ."
|
|
14
15
|
},
|
|
15
16
|
"author": "Itay Podhajcer",
|
|
@@ -25,7 +26,7 @@
|
|
|
25
26
|
"eslint-plugin-import": "2.32.0",
|
|
26
27
|
"eslint-plugin-prettier": "4.2.5",
|
|
27
28
|
"eslint-watch": "7.0.0",
|
|
28
|
-
"
|
|
29
|
+
"expect": "29.7.0",
|
|
29
30
|
"nock": "15.0.0-beta.5",
|
|
30
31
|
"prettier": "2.8.8"
|
|
31
32
|
},
|
|
@@ -41,5 +42,5 @@
|
|
|
41
42
|
"nanoid": "3.3.11",
|
|
42
43
|
"strip-bom-stream": "^4.0.0"
|
|
43
44
|
},
|
|
44
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "21747614a1db416654bba4c198d1c1b883dbe6a5"
|
|
45
46
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const { after, before, describe, it } = require('node:test');
|
|
2
|
+
const { expect } = require('expect');
|
|
3
|
+
|
|
2
4
|
const path = require('path');
|
|
3
5
|
const nock = require('nock');
|
|
4
|
-
const got = require('got');
|
|
5
6
|
|
|
6
|
-
const gotExtendSpy = jest.spyOn(got, 'extend');
|
|
7
7
|
const { nanoid } = require('nanoid');
|
|
8
8
|
const { runBatchIssuing } = require('../src/batch-issuing/orchestrators');
|
|
9
9
|
|
|
@@ -11,19 +11,15 @@ const ISO_DATETIME_TZ_FORMAT =
|
|
|
11
11
|
/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+\d\d:\d\d|Z)$/;
|
|
12
12
|
|
|
13
13
|
describe('batch issuing test', () => {
|
|
14
|
-
|
|
14
|
+
before(() => {
|
|
15
15
|
nock.cleanAll();
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
after(() => {
|
|
19
19
|
nock.cleanAll();
|
|
20
20
|
nock.restore();
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
beforeEach(() => {
|
|
24
|
-
jest.clearAllMocks();
|
|
25
|
-
});
|
|
26
|
-
|
|
27
23
|
it("should fail if options don't have credential type or type doesn't exist", async () => {
|
|
28
24
|
const options = {
|
|
29
25
|
csvFilename: path.join(__dirname, 'data/batch-vars-offerids.csv'),
|
|
@@ -1469,55 +1465,4 @@ describe('batch issuing test', () => {
|
|
|
1469
1465
|
});
|
|
1470
1466
|
});
|
|
1471
1467
|
});
|
|
1472
|
-
|
|
1473
|
-
describe('https.rejectUnauthorized test suite', () => {
|
|
1474
|
-
beforeEach(() => {
|
|
1475
|
-
env.NODE_TLS_REJECT_UNAUTHORIZED = '';
|
|
1476
|
-
});
|
|
1477
|
-
afterAll(() => {
|
|
1478
|
-
env.NODE_TLS_REJECT_UNAUTHORIZED = '';
|
|
1479
|
-
});
|
|
1480
|
-
|
|
1481
|
-
it('when NODE_TLS_REJECT_UNAUTHORIZED is "0", got client should be setup with https.rejectUnauthorized false', async () => {
|
|
1482
|
-
env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
|
|
1483
|
-
const options = {
|
|
1484
|
-
csvFilename: path.join(__dirname, 'data/batch-vars-offerids.csv'),
|
|
1485
|
-
offerTemplateFilename: path.join(
|
|
1486
|
-
__dirname,
|
|
1487
|
-
'data/email-offer.template.json'
|
|
1488
|
-
),
|
|
1489
|
-
tenant: 'foo',
|
|
1490
|
-
termsUrl: 'http://example.com/terms.html',
|
|
1491
|
-
new: true,
|
|
1492
|
-
dryrun: true,
|
|
1493
|
-
};
|
|
1494
|
-
await runBatchIssuing(options);
|
|
1495
|
-
expect(gotExtendSpy.mock.calls).toEqual([
|
|
1496
|
-
[{ https: { rejectUnauthorized: false } }],
|
|
1497
|
-
]);
|
|
1498
|
-
});
|
|
1499
|
-
|
|
1500
|
-
it('when NODE_TLS_REJECT_UNAUTHORIZED is value other than "0", got client should be setup without https.rejectUnauthorized', async () => {
|
|
1501
|
-
const options = {
|
|
1502
|
-
csvFilename: path.join(__dirname, 'data/batch-vars-offerids.csv'),
|
|
1503
|
-
offerTemplateFilename: path.join(
|
|
1504
|
-
__dirname,
|
|
1505
|
-
'data/email-offer.template.json'
|
|
1506
|
-
),
|
|
1507
|
-
tenant: 'foo',
|
|
1508
|
-
termsUrl: 'http://example.com/terms.html',
|
|
1509
|
-
new: true,
|
|
1510
|
-
dryrun: true,
|
|
1511
|
-
};
|
|
1512
|
-
env.NODE_TLS_REJECT_UNAUTHORIZED = 'false';
|
|
1513
|
-
await runBatchIssuing(options);
|
|
1514
|
-
env.NODE_TLS_REJECT_UNAUTHORIZED = '';
|
|
1515
|
-
await runBatchIssuing(options);
|
|
1516
|
-
env.NODE_TLS_REJECT_UNAUTHORIZED = 'undefined';
|
|
1517
|
-
await runBatchIssuing(options);
|
|
1518
|
-
delete env.NODE_TLS_REJECT_UNAUTHORIZED;
|
|
1519
|
-
await runBatchIssuing(options);
|
|
1520
|
-
expect(gotExtendSpy.mock.calls).toEqual([[{}], [{}], [{}], [{}]]);
|
|
1521
|
-
});
|
|
1522
|
-
});
|
|
1523
1468
|
});
|
package/jest.config.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2023 Velocity Team
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const jestConfig = require('../../jest.config.base');
|
|
18
|
-
const pack = require('./package.json');
|
|
19
|
-
|
|
20
|
-
module.exports = jestConfig(pack.name);
|