@cloudcommerce/app-correios 0.25.0 → 0.26.1
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/.turbo/turbo-build.log
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/app-correios",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.26.1",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce app for Correios shipping calculation",
|
|
6
6
|
"main": "lib/correios.js",
|
|
7
7
|
"repository": {
|
|
@@ -16,14 +16,16 @@
|
|
|
16
16
|
},
|
|
17
17
|
"homepage": "https://github.com/ecomplus/cloud-commerce/tree/main/packages/apps/correios#readme",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"axios": "^1.
|
|
19
|
+
"axios": "^1.5.0",
|
|
20
20
|
"xml2js": "0.6.2",
|
|
21
|
-
"@cloudcommerce/api": "0.
|
|
21
|
+
"@cloudcommerce/api": "0.26.1"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@cloudcommerce/
|
|
24
|
+
"@cloudcommerce/test-base": "0.26.1",
|
|
25
|
+
"@cloudcommerce/types": "0.26.1"
|
|
25
26
|
},
|
|
26
27
|
"scripts": {
|
|
27
|
-
"build": "bash ../../../scripts/build-lib.sh"
|
|
28
|
+
"build": "bash ../../../scripts/build-lib.sh",
|
|
29
|
+
"test:e2e": "node --test tests/"
|
|
28
30
|
}
|
|
29
31
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
|
+
import assert from 'node:assert';
|
|
3
|
+
import test, { before, describe } from 'node:test';
|
|
4
|
+
import {
|
|
5
|
+
modulesUrl,
|
|
6
|
+
bodyCalculateShipping,
|
|
7
|
+
} from '@cloudcommerce/test-base';
|
|
8
|
+
|
|
9
|
+
describe('Test Shipping Calculation in the Correios App', async () => {
|
|
10
|
+
let req;
|
|
11
|
+
let data;
|
|
12
|
+
const appId = 1248;
|
|
13
|
+
|
|
14
|
+
before(async () => {
|
|
15
|
+
req = await fetch(`${modulesUrl}/calculate_shipping?app_id=${appId}`, {
|
|
16
|
+
method: 'POST',
|
|
17
|
+
body: JSON.stringify(bodyCalculateShipping),
|
|
18
|
+
headers: {
|
|
19
|
+
'Content-Type': 'application/json',
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
data = (await req.json()).result;
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test('Check Status 200', async () => {
|
|
27
|
+
assert.strictEqual(req?.status, 200);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test('Check validated is true', async () => {
|
|
31
|
+
assert.equal(data[0].validated, true);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test('Have shipping services', async () => {
|
|
35
|
+
assert.equal(data[0].response.shipping_services.length > 0, true);
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test('Has PAC shipping services', async () => {
|
|
39
|
+
assert.equal((data[0].response.shipping_services.find((service) => service.label === 'PAC')).label, 'PAC');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test('Has SEDEX shipping services', async () => {
|
|
43
|
+
assert.equal((data[0].response.shipping_services.find((service) => service.label === 'SEDEX')).label, 'SEDEX');
|
|
44
|
+
});
|
|
45
|
+
});
|