@chift/chift-nodejs 1.0.16 → 1.0.18
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/README.md +3 -3
- package/package.json +5 -2
- package/src/types/public-api/schema.d.ts +4071 -850
- package/src/types/sync.ts +20 -5
- package/.eslintcache +0 -1
- package/.eslintignore +0 -1
- package/.eslintrc.json +0 -25
- package/.github/workflows/ci.yml +0 -75
- package/.husky/pre-commit +0 -4
- package/.prettierignore +0 -1
- package/.prettierrc.json +0 -7
- package/CHANGELOG.md +0 -98
- package/coverage/clover.xml +0 -1645
- package/coverage/coverage-final.json +0 -19
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -146
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov-report/src/helpers/index.html +0 -131
- package/coverage/lcov-report/src/helpers/openapi.ts.html +0 -151
- package/coverage/lcov-report/src/helpers/settings.ts.html +0 -94
- package/coverage/lcov-report/src/index.html +0 -116
- package/coverage/lcov-report/src/index.ts.html +0 -88
- package/coverage/lcov-report/src/modules/accounting.ts.html +0 -1156
- package/coverage/lcov-report/src/modules/api.ts.html +0 -190
- package/coverage/lcov-report/src/modules/consumer.ts.html +0 -616
- package/coverage/lcov-report/src/modules/consumers.ts.html +0 -331
- package/coverage/lcov-report/src/modules/custom.ts.html +0 -193
- package/coverage/lcov-report/src/modules/datastores.ts.html +0 -142
- package/coverage/lcov-report/src/modules/ecommerce.ts.html +0 -331
- package/coverage/lcov-report/src/modules/flow.ts.html +0 -589
- package/coverage/lcov-report/src/modules/index.html +0 -326
- package/coverage/lcov-report/src/modules/integrations.ts.html +0 -151
- package/coverage/lcov-report/src/modules/internalApi.ts.html +0 -586
- package/coverage/lcov-report/src/modules/invoicing.ts.html +0 -391
- package/coverage/lcov-report/src/modules/pos.ts.html +0 -421
- package/coverage/lcov-report/src/modules/sync.ts.html +0 -316
- package/coverage/lcov-report/src/modules/syncs.ts.html +0 -169
- package/coverage/lcov-report/src/modules/webhooks.ts.html +0 -343
- package/coverage/lcov.info +0 -1976
- package/dist/src/helpers/openapi.d.ts +0 -3
- package/dist/src/helpers/openapi.js +0 -18
- package/dist/src/helpers/settings.d.ts +0 -4
- package/dist/src/helpers/settings.js +0 -5
- package/dist/src/index.d.ts +0 -1
- package/dist/src/modules/accounting.d.ts +0 -68
- package/dist/src/modules/accounting.js +0 -326
- package/dist/src/modules/api.d.ts +0 -16795
- package/dist/src/modules/api.js +0 -36
- package/dist/src/modules/consumer.d.ts +0 -3313
- package/dist/src/modules/consumer.js +0 -139
- package/dist/src/modules/consumers.d.ts +0 -16684
- package/dist/src/modules/consumers.js +0 -51
- package/dist/src/modules/custom.d.ts +0 -8
- package/dist/src/modules/custom.js +0 -36
- package/dist/src/modules/datastores.d.ts +0 -18
- package/dist/src/modules/datastores.js +0 -23
- package/dist/src/modules/ecommerce.d.ts +0 -24
- package/dist/src/modules/ecommerce.js +0 -97
- package/dist/src/modules/flow.d.ts +0 -15
- package/dist/src/modules/flow.js +0 -156
- package/dist/src/modules/integrations.d.ts +0 -23
- package/dist/src/modules/integrations.js +0 -23
- package/dist/src/modules/internalApi.d.ts +0 -24
- package/dist/src/modules/internalApi.js +0 -175
- package/dist/src/modules/invoicing.d.ts +0 -20
- package/dist/src/modules/invoicing.js +0 -90
- package/dist/src/modules/pms.d.ts +0 -15
- package/dist/src/modules/pms.js +0 -47
- package/dist/src/modules/pos.d.ts +0 -26
- package/dist/src/modules/pos.js +0 -101
- package/dist/src/modules/sync.d.ts +0 -13414
- package/dist/src/modules/sync.js +0 -73
- package/dist/src/modules/syncs.d.ts +0 -11
- package/dist/src/modules/syncs.js +0 -39
- package/dist/src/modules/webhooks.d.ts +0 -55
- package/dist/src/modules/webhooks.js +0 -53
- package/dist/src/types/api.d.ts +0 -29
- package/dist/src/types/api.js +0 -2
- package/dist/src/types/consumers.d.ts +0 -8
- package/dist/src/types/consumers.js +0 -2
- package/dist/src/types/public-api/mappings.d.ts +0 -21
- package/dist/src/types/public-api/mappings.js +0 -2
- package/dist/src/types/public-api/schema.d.ts +0 -12003
- package/dist/src/types/public-api/schema.js +0 -6
- package/dist/src/types/sync.d.ts +0 -20
- package/dist/src/types/sync.js +0 -2
- package/dist/test/modules/accounting.test.d.ts +0 -1
- package/dist/test/modules/accounting.test.js +0 -582
- package/dist/test/modules/consumer.test.d.ts +0 -1
- package/dist/test/modules/consumer.test.js +0 -89
- package/dist/test/modules/consumers.test.d.ts +0 -1
- package/dist/test/modules/consumers.test.js +0 -109
- package/dist/test/modules/ecommerce.test.d.ts +0 -1
- package/dist/test/modules/ecommerce.test.js +0 -220
- package/dist/test/modules/integrations.test.d.ts +0 -1
- package/dist/test/modules/integrations.test.js +0 -54
- package/dist/test/modules/invoicing.test.d.ts +0 -1
- package/dist/test/modules/invoicing.test.js +0 -108
- package/dist/test/modules/pos.test.d.ts +0 -1
- package/dist/test/modules/pos.test.js +0 -182
- package/dist/test/modules/sync.test.d.ts +0 -1
- package/dist/test/modules/sync.test.js +0 -81
- package/dist/test/modules/syncs.test.d.ts +0 -1
- package/dist/test/modules/syncs.test.js +0 -53
- package/dist/test/modules/webhooks.test.d.ts +0 -1
- package/dist/test/modules/webhooks.test.js +0 -120
- package/jest.config.ts +0 -195
- package/src/helpers/openapi.ts +0 -22
- package/src/helpers/settings.ts +0 -3
- package/src/index.ts +0 -1
- package/src/modules/accounting.ts +0 -510
- package/src/modules/api.ts +0 -35
- package/src/modules/consumer.ts +0 -213
- package/src/modules/consumers.ts +0 -82
- package/src/modules/custom.ts +0 -36
- package/src/modules/datastores.ts +0 -19
- package/src/modules/ecommerce.ts +0 -127
- package/src/modules/flow.ts +0 -168
- package/src/modules/integrations.ts +0 -24
- package/src/modules/internalApi.ts +0 -182
- package/src/modules/invoicing.ts +0 -114
- package/src/modules/pms.ts +0 -67
- package/src/modules/pos.ts +0 -144
- package/src/modules/sync.ts +0 -77
- package/src/modules/syncs.ts +0 -59
- package/src/modules/webhooks.ts +0 -86
- package/src/types/public-api/schema.ts +0 -12073
- package/test/data/accounting_invoice.pdf +0 -0
- package/test/modules/accounting.test.ts +0 -628
- package/test/modules/consumer.test.ts +0 -68
- package/test/modules/consumers.test.ts +0 -85
- package/test/modules/ecommerce.test.ts +0 -208
- package/test/modules/integrations.test.ts +0 -22
- package/test/modules/invoicing.test.ts +0 -88
- package/test/modules/pos.test.ts +0 -166
- package/test/modules/sync.test.ts +0 -60
- package/test/modules/syncs.test.ts +0 -23
- package/test/modules/webhooks.test.ts +0 -92
- package/test/set_envs.sh +0 -14
- package/tsconfig.json +0 -107
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
const globals_1 = require("@jest/globals");
|
|
36
|
-
const chift = __importStar(require("../../src/index"));
|
|
37
|
-
const dotenv = __importStar(require("dotenv"));
|
|
38
|
-
dotenv.config();
|
|
39
|
-
const client = new chift.API({
|
|
40
|
-
baseUrl: process.env.CHIFT_BASE_URL,
|
|
41
|
-
clientId: process.env.CHIFT_CLIENT_ID,
|
|
42
|
-
clientSecret: process.env.CHIFT_CLIENT_SECRET,
|
|
43
|
-
accountId: process.env.CHIFT_ACCOUNT_ID,
|
|
44
|
-
});
|
|
45
|
-
const consumerName = 'test consumer 2';
|
|
46
|
-
const email = 'support@chift.eu';
|
|
47
|
-
const redirect_url = 'https://chift.eu';
|
|
48
|
-
let syncConsumer;
|
|
49
|
-
let consumer;
|
|
50
|
-
let connection;
|
|
51
|
-
(0, globals_1.beforeAll)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
|
-
consumer = yield client.Consumers.createConsumer({
|
|
53
|
-
email,
|
|
54
|
-
redirect_url,
|
|
55
|
-
name: consumerName,
|
|
56
|
-
});
|
|
57
|
-
syncConsumer = yield client.Consumers.getConsumerById(process.env.CHIFT_SYNC_CONSUMER_ID);
|
|
58
|
-
}));
|
|
59
|
-
(0, globals_1.test)('createConnection', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
60
|
-
const body = { integrationid: 1000, name: 'odoo test sdk' };
|
|
61
|
-
const result = yield consumer.createConnection(body);
|
|
62
|
-
(0, globals_1.expect)(result).toHaveProperty('url', globals_1.expect.any(String));
|
|
63
|
-
}));
|
|
64
|
-
let connections;
|
|
65
|
-
(0, globals_1.test)('getConnections', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
66
|
-
connections = yield syncConsumer.getConnections();
|
|
67
|
-
(0, globals_1.expect)(connections).toBeInstanceOf(Array);
|
|
68
|
-
}));
|
|
69
|
-
globals_1.test.skip('updateConnection', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
70
|
-
var _a;
|
|
71
|
-
const updatedConnection = yield syncConsumer.updateConnection((_a = connections[0]) === null || _a === void 0 ? void 0 : _a.connectionid, {
|
|
72
|
-
name: 'updated connection name',
|
|
73
|
-
});
|
|
74
|
-
(0, globals_1.expect)(updatedConnection).toHaveProperty('name', 'updated connection name');
|
|
75
|
-
}));
|
|
76
|
-
globals_1.test.skip('deleteConnection', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
77
|
-
yield consumer.deleteConnection(connection.connectionId);
|
|
78
|
-
}));
|
|
79
|
-
(0, globals_1.test)('getSyncUrl', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
80
|
-
const result = yield syncConsumer.getSyncUrl({
|
|
81
|
-
syncid: process.env.CHIFT_TEST_SYNC_ID,
|
|
82
|
-
integrationids: [],
|
|
83
|
-
});
|
|
84
|
-
(0, globals_1.expect)(result).toHaveProperty('url', globals_1.expect.any(String));
|
|
85
|
-
}));
|
|
86
|
-
(0, globals_1.test)('getSyncData', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
87
|
-
const syncData = yield syncConsumer.getSyncData(process.env.CHIFT_TEST_SYNC_ID);
|
|
88
|
-
(0, globals_1.expect)(syncData).toBeTruthy();
|
|
89
|
-
}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
-
};
|
|
37
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
const globals_1 = require("@jest/globals");
|
|
39
|
-
const chift = __importStar(require("../../src/index"));
|
|
40
|
-
const axios_1 = __importDefault(require("axios"));
|
|
41
|
-
const dotenv = __importStar(require("dotenv"));
|
|
42
|
-
dotenv.config();
|
|
43
|
-
const client = new chift.API({
|
|
44
|
-
baseUrl: process.env.CHIFT_BASE_URL,
|
|
45
|
-
clientId: process.env.CHIFT_CLIENT_ID,
|
|
46
|
-
clientSecret: process.env.CHIFT_CLIENT_SECRET,
|
|
47
|
-
accountId: process.env.CHIFT_ACCOUNT_ID,
|
|
48
|
-
});
|
|
49
|
-
const consumerName = 'test consumer';
|
|
50
|
-
const email = 'support@chift.eu';
|
|
51
|
-
const redirect_url = 'https://chift.eu';
|
|
52
|
-
let consumer;
|
|
53
|
-
(0, globals_1.beforeAll)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
54
|
-
consumer = yield client.Consumers.createConsumer({
|
|
55
|
-
email,
|
|
56
|
-
redirect_url,
|
|
57
|
-
name: consumerName,
|
|
58
|
-
});
|
|
59
|
-
}));
|
|
60
|
-
(0, globals_1.test)('createConsumer', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
61
|
-
(0, globals_1.expect)(consumer).toHaveProperty('consumerId');
|
|
62
|
-
(0, globals_1.expect)(consumer).toHaveProperty('getConnections');
|
|
63
|
-
(0, globals_1.expect)(consumer).toHaveProperty('createConnection');
|
|
64
|
-
(0, globals_1.expect)(consumer).toHaveProperty('updateConnection');
|
|
65
|
-
(0, globals_1.expect)(consumer).toHaveProperty('deleteConnection');
|
|
66
|
-
(0, globals_1.expect)(consumer).toHaveProperty('getSyncUrl');
|
|
67
|
-
(0, globals_1.expect)(consumer).toHaveProperty('name', consumerName);
|
|
68
|
-
(0, globals_1.expect)(consumer).toHaveProperty('redirect_url', redirect_url);
|
|
69
|
-
(0, globals_1.expect)(consumer).toHaveProperty('email', email);
|
|
70
|
-
(0, globals_1.expect)(consumer).toHaveProperty('pos');
|
|
71
|
-
(0, globals_1.expect)(consumer).toHaveProperty('accounting');
|
|
72
|
-
(0, globals_1.expect)(consumer).toHaveProperty('invoicing');
|
|
73
|
-
(0, globals_1.expect)(consumer).toHaveProperty('ecommerce');
|
|
74
|
-
(0, globals_1.expect)(consumer).toHaveProperty('custom');
|
|
75
|
-
}));
|
|
76
|
-
(0, globals_1.test)('getConsumers', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
77
|
-
const consumers = yield client.Consumers.getConsumers();
|
|
78
|
-
(0, globals_1.expect)(consumers).toBeInstanceOf(Array);
|
|
79
|
-
}));
|
|
80
|
-
(0, globals_1.test)('getConsumersByName', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
81
|
-
const consumersWithName = yield client.Consumers.getConsumersByName(consumerName);
|
|
82
|
-
(0, globals_1.expect)(consumersWithName).toBeInstanceOf(Array);
|
|
83
|
-
(0, globals_1.expect)(consumersWithName.some((consumer) => consumer.name.includes(consumerName))).toBe(true);
|
|
84
|
-
}));
|
|
85
|
-
(0, globals_1.test)('getConsumerById', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
86
|
-
const consumerWithId = yield client.Consumers.getConsumerById(consumer.consumerId);
|
|
87
|
-
(0, globals_1.expect)(consumerWithId).toHaveProperty('consumerId', consumer.consumerId);
|
|
88
|
-
}));
|
|
89
|
-
(0, globals_1.test)('updateConsumerById', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
90
|
-
const updatedName = 'updated test consumer';
|
|
91
|
-
const updatedConsumer = yield client.Consumers.updateConsumerById(consumer.consumerId, {
|
|
92
|
-
name: updatedName,
|
|
93
|
-
});
|
|
94
|
-
(0, globals_1.expect)(updatedConsumer).toHaveProperty('name', updatedName);
|
|
95
|
-
}));
|
|
96
|
-
(0, globals_1.test)('deleteConsumerById', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
97
|
-
globals_1.expect.assertions(1);
|
|
98
|
-
try {
|
|
99
|
-
yield client.Consumers.deleteConsumerById(consumer.consumerId);
|
|
100
|
-
yield client.Consumers.getConsumerById(consumer.consumerId);
|
|
101
|
-
}
|
|
102
|
-
catch (e) {
|
|
103
|
-
if (axios_1.default.isAxiosError(e)) {
|
|
104
|
-
(0, globals_1.expect)(e.message).toMatch('Request failed with status code 404');
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
throw e;
|
|
108
|
-
}
|
|
109
|
-
}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
const globals_1 = require("@jest/globals");
|
|
36
|
-
const chift = __importStar(require("../../src/index"));
|
|
37
|
-
const dotenv = __importStar(require("dotenv"));
|
|
38
|
-
dotenv.config();
|
|
39
|
-
const client = new chift.API({
|
|
40
|
-
baseUrl: process.env.CHIFT_BASE_URL,
|
|
41
|
-
clientId: process.env.CHIFT_CLIENT_ID,
|
|
42
|
-
clientSecret: process.env.CHIFT_CLIENT_SECRET,
|
|
43
|
-
accountId: process.env.CHIFT_ACCOUNT_ID,
|
|
44
|
-
});
|
|
45
|
-
const consumerId = process.env.CHIFT_WOOCOMMERCE_CONSUMER_ID;
|
|
46
|
-
let consumer;
|
|
47
|
-
(0, globals_1.beforeAll)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
|
-
consumer = yield client.Consumers.getConsumerById(consumerId);
|
|
49
|
-
}));
|
|
50
|
-
let customers;
|
|
51
|
-
(0, globals_1.test)('getCustomers', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
|
-
customers = yield consumer.ecommerce.getCustomers();
|
|
53
|
-
(0, globals_1.expect)(customers).toBeInstanceOf(Array);
|
|
54
|
-
(0, globals_1.expect)(customers.length).toBeGreaterThan(0);
|
|
55
|
-
(0, globals_1.expect)(customers[0]).toHaveProperty('id', globals_1.expect.any(String));
|
|
56
|
-
}));
|
|
57
|
-
let products;
|
|
58
|
-
(0, globals_1.test)('getProducts', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
-
products = yield consumer.ecommerce.getProducts();
|
|
60
|
-
(0, globals_1.expect)(products).toBeInstanceOf(Array);
|
|
61
|
-
(0, globals_1.expect)(products.length).toBeGreaterThan(0);
|
|
62
|
-
(0, globals_1.expect)(products[0]).toHaveProperty('id', globals_1.expect.any(String));
|
|
63
|
-
}));
|
|
64
|
-
(0, globals_1.test)('getCustomer', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
65
|
-
const customer = yield consumer.ecommerce.getCustomer(customers[0].id);
|
|
66
|
-
(0, globals_1.expect)(customer).toHaveProperty('id', customers[0].id);
|
|
67
|
-
(0, globals_1.expect)(customer).toHaveProperty('first_name');
|
|
68
|
-
(0, globals_1.expect)(customer).toHaveProperty('last_name');
|
|
69
|
-
(0, globals_1.expect)(customer).toHaveProperty('phone');
|
|
70
|
-
(0, globals_1.expect)(customer).toHaveProperty('email');
|
|
71
|
-
(0, globals_1.expect)(customer).toHaveProperty('language');
|
|
72
|
-
(0, globals_1.expect)(customer).toHaveProperty('internal_notes');
|
|
73
|
-
(0, globals_1.expect)(customer).toHaveProperty('currency');
|
|
74
|
-
(0, globals_1.expect)(customer).toHaveProperty('addresses');
|
|
75
|
-
(0, globals_1.expect)(customer).toHaveProperty('created_on');
|
|
76
|
-
}));
|
|
77
|
-
(0, globals_1.test)('getProduct', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
78
|
-
const product = yield consumer.ecommerce.getProduct(products[0].id);
|
|
79
|
-
(0, globals_1.expect)(product).toBeTruthy();
|
|
80
|
-
(0, globals_1.expect)(product).toHaveProperty('id', products[0].id);
|
|
81
|
-
(0, globals_1.expect)(product).toHaveProperty('name', globals_1.expect.any(String));
|
|
82
|
-
(0, globals_1.expect)(product).toHaveProperty('description');
|
|
83
|
-
(0, globals_1.expect)(product).toHaveProperty('description_html');
|
|
84
|
-
(0, globals_1.expect)(product).toHaveProperty('categories');
|
|
85
|
-
(0, globals_1.expect)(product).toHaveProperty('created_on');
|
|
86
|
-
(0, globals_1.expect)(product).toHaveProperty('variants');
|
|
87
|
-
(0, globals_1.expect)(product).toHaveProperty('status');
|
|
88
|
-
(0, globals_1.expect)(product).toHaveProperty('common_attributes');
|
|
89
|
-
(0, globals_1.expect)(product).toHaveProperty('variant_attributes_options');
|
|
90
|
-
(0, globals_1.expect)(product).toHaveProperty('common_images');
|
|
91
|
-
}));
|
|
92
|
-
(0, globals_1.test)('getProductVariantById', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
93
|
-
if (!(products === null || products === void 0 ? void 0 : products.length)) {
|
|
94
|
-
throw new Error('No product to test');
|
|
95
|
-
}
|
|
96
|
-
if (!products[0].variants) {
|
|
97
|
-
throw new Error('No product variant to test');
|
|
98
|
-
}
|
|
99
|
-
const variant = yield consumer.ecommerce.getProductVariantById(products[0].variants[0].id);
|
|
100
|
-
(0, globals_1.expect)(variant).toBeTruthy();
|
|
101
|
-
(0, globals_1.expect)(variant).toHaveProperty('id', globals_1.expect.any(String));
|
|
102
|
-
}));
|
|
103
|
-
let locations;
|
|
104
|
-
(0, globals_1.test)('getLocations', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
105
|
-
locations = yield consumer.ecommerce.getLocations();
|
|
106
|
-
(0, globals_1.expect)(locations).toBeInstanceOf(Array);
|
|
107
|
-
(0, globals_1.expect)(locations.length).toBeGreaterThan(0);
|
|
108
|
-
(0, globals_1.expect)(locations[0]).toHaveProperty('id', globals_1.expect.any(String));
|
|
109
|
-
(0, globals_1.expect)(locations[0]).toHaveProperty('name', globals_1.expect.any(String));
|
|
110
|
-
}));
|
|
111
|
-
(0, globals_1.test)('updateAvailableQuantity', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
112
|
-
if (!(products === null || products === void 0 ? void 0 : products.length)) {
|
|
113
|
-
throw new Error('No product to test');
|
|
114
|
-
}
|
|
115
|
-
if (!products[0].variants) {
|
|
116
|
-
throw new Error('No product variant to test');
|
|
117
|
-
}
|
|
118
|
-
const product = yield consumer.ecommerce.updateAvailableQuantity(products[0].variants[0].id, {
|
|
119
|
-
location_id: locations[0].id,
|
|
120
|
-
available_quantity: 1,
|
|
121
|
-
});
|
|
122
|
-
(0, globals_1.expect)(product).toBeTruthy();
|
|
123
|
-
(0, globals_1.expect)(product).toHaveProperty('available_quantity', globals_1.expect.any(Number));
|
|
124
|
-
}));
|
|
125
|
-
// TODO: Fix create order test
|
|
126
|
-
globals_1.test.skip('createOrder', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
127
|
-
const order = yield consumer.ecommerce.createOrder({
|
|
128
|
-
customer: {
|
|
129
|
-
email: 'test@test.com',
|
|
130
|
-
},
|
|
131
|
-
billing_address: {
|
|
132
|
-
first_name: 'Test',
|
|
133
|
-
last_name: 'Test',
|
|
134
|
-
street: 'Test',
|
|
135
|
-
number: '1',
|
|
136
|
-
city: 'Test',
|
|
137
|
-
country: 'BE',
|
|
138
|
-
},
|
|
139
|
-
shipping_address: {
|
|
140
|
-
first_name: 'Test',
|
|
141
|
-
last_name: 'Test',
|
|
142
|
-
street: 'Test',
|
|
143
|
-
number: '1',
|
|
144
|
-
city: 'Test',
|
|
145
|
-
country: 'BE',
|
|
146
|
-
},
|
|
147
|
-
currency: 'EUR',
|
|
148
|
-
lines: [
|
|
149
|
-
{
|
|
150
|
-
variant_id: '1',
|
|
151
|
-
quantity: 1,
|
|
152
|
-
tax_rate: 21.0,
|
|
153
|
-
unit_price: 10.0,
|
|
154
|
-
},
|
|
155
|
-
],
|
|
156
|
-
payment_method: 'bank-transfer',
|
|
157
|
-
});
|
|
158
|
-
(0, globals_1.expect)(order).toBeTruthy();
|
|
159
|
-
(0, globals_1.expect)(order).toHaveProperty('id', globals_1.expect.any(String));
|
|
160
|
-
}));
|
|
161
|
-
let orders;
|
|
162
|
-
(0, globals_1.test)('getOrders', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
163
|
-
orders = yield consumer.ecommerce.getOrders({
|
|
164
|
-
date_from: '2021-10-01',
|
|
165
|
-
date_to: '2021-12-31',
|
|
166
|
-
});
|
|
167
|
-
(0, globals_1.expect)(orders).toBeInstanceOf(Array);
|
|
168
|
-
}));
|
|
169
|
-
(0, globals_1.test)('getOrder', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
170
|
-
const order = yield consumer.ecommerce.getOrder(orders[0].id);
|
|
171
|
-
(0, globals_1.expect)(order).toBeTruthy();
|
|
172
|
-
(0, globals_1.expect)(order).toHaveProperty('id', globals_1.expect.any(String));
|
|
173
|
-
(0, globals_1.expect)(order).toHaveProperty('order_number');
|
|
174
|
-
(0, globals_1.expect)(order).toHaveProperty('billing_address');
|
|
175
|
-
(0, globals_1.expect)(order).toHaveProperty('shipping_address');
|
|
176
|
-
(0, globals_1.expect)(order).toHaveProperty('created_on');
|
|
177
|
-
(0, globals_1.expect)(order).toHaveProperty('confirmed_on');
|
|
178
|
-
(0, globals_1.expect)(order).toHaveProperty('cancelled_on');
|
|
179
|
-
(0, globals_1.expect)(order).toHaveProperty('status', globals_1.expect.any(String));
|
|
180
|
-
(0, globals_1.expect)(order).toHaveProperty('discount_amount', globals_1.expect.any(Number));
|
|
181
|
-
(0, globals_1.expect)(order).toHaveProperty('untaxed_amount_without_fees', globals_1.expect.any(Number));
|
|
182
|
-
(0, globals_1.expect)(order).toHaveProperty('tax_amount_without_fees', globals_1.expect.any(Number));
|
|
183
|
-
(0, globals_1.expect)(order).toHaveProperty('total_without_fees', globals_1.expect.any(Number));
|
|
184
|
-
(0, globals_1.expect)(order).toHaveProperty('untaxed_amount', globals_1.expect.any(Number));
|
|
185
|
-
(0, globals_1.expect)(order).toHaveProperty('tax_amount', globals_1.expect.any(Number));
|
|
186
|
-
(0, globals_1.expect)(order).toHaveProperty('total', globals_1.expect.any(Number));
|
|
187
|
-
(0, globals_1.expect)(order).toHaveProperty('refunded_amount', globals_1.expect.any(Number));
|
|
188
|
-
(0, globals_1.expect)(order).toHaveProperty('currency');
|
|
189
|
-
(0, globals_1.expect)(order).toHaveProperty('note');
|
|
190
|
-
(0, globals_1.expect)(order).toHaveProperty('lines', globals_1.expect.any(Array));
|
|
191
|
-
(0, globals_1.expect)(order).toHaveProperty('other_fees');
|
|
192
|
-
}));
|
|
193
|
-
(0, globals_1.test)('getPaymentMethods', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
194
|
-
const paymentMethods = yield consumer.ecommerce.getPaymentMethods();
|
|
195
|
-
(0, globals_1.expect)(paymentMethods).toBeInstanceOf(Array);
|
|
196
|
-
(0, globals_1.expect)(paymentMethods.length).toBeGreaterThan(0);
|
|
197
|
-
(0, globals_1.expect)(paymentMethods[0]).toHaveProperty('id', globals_1.expect.any(String));
|
|
198
|
-
(0, globals_1.expect)(paymentMethods[0]).toHaveProperty('name', globals_1.expect.any(String));
|
|
199
|
-
}));
|
|
200
|
-
(0, globals_1.test)('getProductCategories', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
201
|
-
const productCategories = yield consumer.ecommerce.getProductCategories();
|
|
202
|
-
(0, globals_1.expect)(productCategories).toBeInstanceOf(Array);
|
|
203
|
-
(0, globals_1.expect)(productCategories.length).toBeGreaterThan(0);
|
|
204
|
-
(0, globals_1.expect)(productCategories[0]).toHaveProperty('id', globals_1.expect.any(String));
|
|
205
|
-
(0, globals_1.expect)(productCategories[0]).toHaveProperty('name', globals_1.expect.any(String));
|
|
206
|
-
}));
|
|
207
|
-
(0, globals_1.test)('getCountries', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
208
|
-
const countries = yield consumer.ecommerce.getCountries();
|
|
209
|
-
(0, globals_1.expect)(countries).toBeInstanceOf(Array);
|
|
210
|
-
(0, globals_1.expect)(countries.length).toBeGreaterThan(0);
|
|
211
|
-
(0, globals_1.expect)(countries[0]).toHaveProperty('code', globals_1.expect.any(String));
|
|
212
|
-
(0, globals_1.expect)(countries[0]).toHaveProperty('name', globals_1.expect.any(String));
|
|
213
|
-
}));
|
|
214
|
-
(0, globals_1.test)('getTaxes', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
215
|
-
const taxes = yield consumer.ecommerce.getTaxes();
|
|
216
|
-
(0, globals_1.expect)(taxes).toBeInstanceOf(Array);
|
|
217
|
-
(0, globals_1.expect)(taxes.length).toBeGreaterThan(0);
|
|
218
|
-
(0, globals_1.expect)(taxes[0]).toHaveProperty('id', globals_1.expect.any(String));
|
|
219
|
-
(0, globals_1.expect)(taxes[0]).toHaveProperty('rate', globals_1.expect.any(Number));
|
|
220
|
-
}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
const globals_1 = require("@jest/globals");
|
|
36
|
-
const chift = __importStar(require("../../src/index"));
|
|
37
|
-
const dotenv = __importStar(require("dotenv"));
|
|
38
|
-
dotenv.config();
|
|
39
|
-
const client = new chift.API({
|
|
40
|
-
baseUrl: process.env.CHIFT_BASE_URL,
|
|
41
|
-
clientId: process.env.CHIFT_CLIENT_ID,
|
|
42
|
-
clientSecret: process.env.CHIFT_CLIENT_SECRET,
|
|
43
|
-
accountId: process.env.CHIFT_ACCOUNT_ID,
|
|
44
|
-
});
|
|
45
|
-
(0, globals_1.test)('getIntegrations', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
46
|
-
const integrations = yield client.Integrations.getIntegrations();
|
|
47
|
-
(0, globals_1.expect)(integrations).toBeInstanceOf(Array);
|
|
48
|
-
(0, globals_1.expect)(integrations.length).toBeGreaterThan(0);
|
|
49
|
-
(0, globals_1.expect)(integrations[0]).toHaveProperty('integrationid', globals_1.expect.any(Number));
|
|
50
|
-
(0, globals_1.expect)(integrations[0]).toHaveProperty('name', globals_1.expect.any(String));
|
|
51
|
-
(0, globals_1.expect)(integrations[0]).toHaveProperty('status', globals_1.expect.stringMatching(/^(active|inactive)$/));
|
|
52
|
-
(0, globals_1.expect)(integrations[0]).toHaveProperty('api', globals_1.expect.any(String));
|
|
53
|
-
(0, globals_1.expect)(integrations[0]).toHaveProperty('credentials', globals_1.expect.any(Array));
|
|
54
|
-
}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
const globals_1 = require("@jest/globals");
|
|
36
|
-
const chift = __importStar(require("../../src/index"));
|
|
37
|
-
const dotenv = __importStar(require("dotenv"));
|
|
38
|
-
dotenv.config();
|
|
39
|
-
const client = new chift.API({
|
|
40
|
-
baseUrl: process.env.CHIFT_BASE_URL,
|
|
41
|
-
clientId: process.env.CHIFT_CLIENT_ID,
|
|
42
|
-
clientSecret: process.env.CHIFT_CLIENT_SECRET,
|
|
43
|
-
accountId: process.env.CHIFT_ACCOUNT_ID,
|
|
44
|
-
});
|
|
45
|
-
const consumerId = process.env.CHIFT_AXONAUT_CONSUMER_ID;
|
|
46
|
-
let consumer;
|
|
47
|
-
(0, globals_1.beforeAll)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
|
-
consumer = yield client.Consumers.getConsumerById(consumerId);
|
|
49
|
-
}));
|
|
50
|
-
let invoices;
|
|
51
|
-
(0, globals_1.test)('getInvoices', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
52
|
-
invoices = yield consumer.invoicing.getInvoices({
|
|
53
|
-
invoice_type: 'customer_invoice',
|
|
54
|
-
date_from: '2023-01-01',
|
|
55
|
-
date_to: '2023-01-31',
|
|
56
|
-
});
|
|
57
|
-
(0, globals_1.expect)(invoices).toBeInstanceOf(Array);
|
|
58
|
-
(0, globals_1.expect)(invoices.length).toBeGreaterThan(0);
|
|
59
|
-
(0, globals_1.expect)(invoices[0]).toHaveProperty('id', globals_1.expect.any(String));
|
|
60
|
-
}));
|
|
61
|
-
(0, globals_1.test)('getInvoiceById', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
62
|
-
const invoice = yield consumer.invoicing.getInvoiceById(invoices[0].id, { include_pdf: false });
|
|
63
|
-
(0, globals_1.expect)(invoice).toHaveProperty('id', globals_1.expect.any(String));
|
|
64
|
-
}));
|
|
65
|
-
let products;
|
|
66
|
-
(0, globals_1.test)('getProducts', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
67
|
-
products = yield consumer.invoicing.getProducts();
|
|
68
|
-
(0, globals_1.expect)(products).toBeInstanceOf(Array);
|
|
69
|
-
(0, globals_1.expect)(products.length).toBeGreaterThan(0);
|
|
70
|
-
(0, globals_1.expect)(products[0]).toHaveProperty('id', globals_1.expect.any(String));
|
|
71
|
-
}));
|
|
72
|
-
(0, globals_1.test)('getProductById', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
73
|
-
const product = yield consumer.invoicing.getProductById(products[0].id);
|
|
74
|
-
(0, globals_1.expect)(product).toHaveProperty('id', globals_1.expect.any(String));
|
|
75
|
-
}));
|
|
76
|
-
let vatCodes;
|
|
77
|
-
(0, globals_1.test)('getTaxes', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
78
|
-
vatCodes = yield consumer.invoicing.getTaxes();
|
|
79
|
-
(0, globals_1.expect)(vatCodes).toBeInstanceOf(Array);
|
|
80
|
-
(0, globals_1.expect)(vatCodes.length).toBeGreaterThan(0);
|
|
81
|
-
(0, globals_1.expect)(vatCodes[0]).toHaveProperty('id', globals_1.expect.any(String));
|
|
82
|
-
}));
|
|
83
|
-
(0, globals_1.test)('getTaxById', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
84
|
-
const tax = yield consumer.invoicing.getTaxById(vatCodes[0].id);
|
|
85
|
-
(0, globals_1.expect)(tax).toHaveProperty('id', globals_1.expect.any(String));
|
|
86
|
-
}));
|
|
87
|
-
let opportunities;
|
|
88
|
-
(0, globals_1.test)('getOpportunities', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
89
|
-
opportunities = yield consumer.invoicing.getOpportunities();
|
|
90
|
-
(0, globals_1.expect)(opportunities).toBeInstanceOf(Array);
|
|
91
|
-
(0, globals_1.expect)(opportunities.length).toBeGreaterThan(0);
|
|
92
|
-
(0, globals_1.expect)(opportunities[0]).toHaveProperty('id', globals_1.expect.any(String));
|
|
93
|
-
}));
|
|
94
|
-
(0, globals_1.test)('getOpportunitiesById', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
95
|
-
const opportunity = yield consumer.invoicing.getOpportunitiesById(opportunities[0].id);
|
|
96
|
-
(0, globals_1.expect)(opportunity).toHaveProperty('id', globals_1.expect.any(String));
|
|
97
|
-
}));
|
|
98
|
-
let contacts;
|
|
99
|
-
(0, globals_1.test)('getContacts', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
100
|
-
contacts = yield consumer.invoicing.getContacts();
|
|
101
|
-
(0, globals_1.expect)(contacts).toBeInstanceOf(Array);
|
|
102
|
-
(0, globals_1.expect)(contacts.length).toBeGreaterThan(0);
|
|
103
|
-
(0, globals_1.expect)(contacts[0]).toHaveProperty('id', globals_1.expect.any(String));
|
|
104
|
-
}));
|
|
105
|
-
(0, globals_1.test)('getContactById', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
106
|
-
const contact = yield consumer.invoicing.getContactById(contacts[0].id);
|
|
107
|
-
(0, globals_1.expect)(contact).toHaveProperty('id', globals_1.expect.any(String));
|
|
108
|
-
}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|