bexio 0.7.2 → 3.0.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/Readme.md +20 -119
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +146 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +196 -0
- package/jest-html-reporters-attach/index.js +58 -0
- package/jest-html-reporters-attach/result.js +1 -0
- package/jest_html_reporters.html +1 -0
- package/junit.xml +155 -0
- package/lib/index.d.ts +9 -103
- package/lib/index.js +55 -237
- package/lib/index.js.map +1 -1
- package/lib/interfaces/BillsStatic.js +1 -0
- package/lib/interfaces/BillsStatic.js.map +1 -1
- package/lib/interfaces/BusinessActivitiesStatic.js +1 -0
- package/lib/interfaces/BusinessActivitiesStatic.js.map +1 -1
- package/lib/interfaces/CalendarStatic.js +1 -0
- package/lib/interfaces/CalendarStatic.js.map +1 -1
- package/lib/interfaces/ContactGroupsStatic.js +1 -0
- package/lib/interfaces/ContactGroupsStatic.js.map +1 -1
- package/lib/interfaces/ContactRelationsStatic.js +1 -0
- package/lib/interfaces/ContactRelationsStatic.js.map +1 -1
- package/lib/interfaces/ContactSectorsStatic.js +1 -0
- package/lib/interfaces/ContactSectorsStatic.js.map +1 -1
- package/lib/interfaces/ContactTypesStatic.js +1 -0
- package/lib/interfaces/ContactTypesStatic.js.map +1 -1
- package/lib/interfaces/ContactsStatic.js +1 -0
- package/lib/interfaces/ContactsStatic.js.map +1 -1
- package/lib/interfaces/ExpensesStatic.js +1 -0
- package/lib/interfaces/ExpensesStatic.js.map +1 -1
- package/lib/interfaces/InvoicesStatic.d.ts +100 -0
- package/lib/interfaces/InvoicesStatic.js +25 -0
- package/lib/interfaces/InvoicesStatic.js.map +1 -0
- package/lib/interfaces/ItemsStatic.d.ts +120 -0
- package/lib/interfaces/ItemsStatic.js +47 -0
- package/lib/interfaces/ItemsStatic.js.map +1 -0
- package/lib/interfaces/NotesStatic.js +1 -0
- package/lib/interfaces/NotesStatic.js.map +1 -1
- package/lib/interfaces/OrdersStatic.js +1 -0
- package/lib/interfaces/OrdersStatic.js.map +1 -1
- package/lib/interfaces/PositionStatic.d.ts +35 -0
- package/lib/interfaces/PositionStatic.js +3 -0
- package/lib/interfaces/PositionStatic.js.map +1 -0
- package/lib/interfaces/ProjectStatusesStatic.js +1 -0
- package/lib/interfaces/ProjectStatusesStatic.js.map +1 -1
- package/lib/interfaces/ProjectTypesStatic.js +1 -0
- package/lib/interfaces/ProjectTypesStatic.js.map +1 -1
- package/lib/interfaces/ProjectsStatic.js +1 -0
- package/lib/interfaces/ProjectsStatic.js.map +1 -1
- package/lib/interfaces/SalesOrderManagementStatic.js +1 -0
- package/lib/interfaces/SalesOrderManagementStatic.js.map +1 -1
- package/lib/interfaces/TimetrackingStatusesStatic.js +1 -0
- package/lib/interfaces/TimetrackingStatusesStatic.js.map +1 -1
- package/lib/interfaces/TimetrackingsStatic.js +1 -0
- package/lib/interfaces/TimetrackingsStatic.js.map +1 -1
- package/lib/interfaces/UsersStatic.js +1 -0
- package/lib/interfaces/UsersStatic.js.map +1 -1
- package/lib/resources/BaseCrud.d.ts +13 -24
- package/lib/resources/BaseCrud.js +37 -44
- package/lib/resources/BaseCrud.js.map +1 -1
- package/lib/resources/Bills.d.ts +5 -6
- package/lib/resources/Bills.js +14 -17
- package/lib/resources/Bills.js.map +1 -1
- package/lib/resources/BusinessActivities.d.ts +1 -2
- package/lib/resources/BusinessActivities.js +2 -3
- package/lib/resources/BusinessActivities.js.map +1 -1
- package/lib/resources/ContactGroups.d.ts +1 -2
- package/lib/resources/ContactGroups.js +3 -4
- package/lib/resources/ContactGroups.js.map +1 -1
- package/lib/resources/ContactRelations.d.ts +1 -2
- package/lib/resources/ContactRelations.js +2 -3
- package/lib/resources/ContactRelations.js.map +1 -1
- package/lib/resources/ContactSectors.d.ts +1 -2
- package/lib/resources/ContactSectors.js +6 -7
- package/lib/resources/ContactSectors.js.map +1 -1
- package/lib/resources/ContactTypes.d.ts +1 -2
- package/lib/resources/ContactTypes.js +6 -7
- package/lib/resources/ContactTypes.js.map +1 -1
- package/lib/resources/Contacts.d.ts +1 -2
- package/lib/resources/Contacts.js +2 -3
- package/lib/resources/Contacts.js.map +1 -1
- package/lib/resources/Expenses.d.ts +2 -3
- package/lib/resources/Expenses.js +4 -5
- package/lib/resources/Expenses.js.map +1 -1
- package/lib/resources/Invoices.d.ts +6 -0
- package/lib/resources/Invoices.js +27 -0
- package/lib/resources/Invoices.js.map +1 -0
- package/lib/resources/Items.d.ts +5 -0
- package/lib/resources/Items.js +13 -0
- package/lib/resources/Items.js.map +1 -0
- package/lib/resources/Orders.d.ts +1 -2
- package/lib/resources/Orders.js +2 -3
- package/lib/resources/Orders.js.map +1 -1
- package/lib/resources/Payments.d.ts +1 -2
- package/lib/resources/Payments.js +2 -11
- package/lib/resources/Payments.js.map +1 -1
- package/lib/resources/ProjectStatuses.d.ts +1 -2
- package/lib/resources/ProjectStatuses.js +2 -3
- package/lib/resources/ProjectStatuses.js.map +1 -1
- package/lib/resources/ProjectTypes.d.ts +1 -2
- package/lib/resources/ProjectTypes.js +6 -7
- package/lib/resources/ProjectTypes.js.map +1 -1
- package/lib/resources/Projects.d.ts +1 -2
- package/lib/resources/Projects.js +2 -3
- package/lib/resources/Projects.js.map +1 -1
- package/lib/resources/TimetrackingStatuses.d.ts +1 -2
- package/lib/resources/TimetrackingStatuses.js +2 -3
- package/lib/resources/TimetrackingStatuses.js.map +1 -1
- package/lib/resources/Timetrackings.d.ts +1 -2
- package/lib/resources/Timetrackings.js +2 -3
- package/lib/resources/Timetrackings.js.map +1 -1
- package/lib/resources/Users.d.ts +1 -2
- package/lib/resources/Users.js +2 -3
- package/lib/resources/Users.js.map +1 -1
- package/lib/tests/BaseCrud.test.js +290 -0
- package/lib/tests/BaseCrud.test.js.map +1 -0
- package/lib/tests/Bills.test.js +93 -143
- package/lib/tests/Bills.test.js.map +1 -1
- package/lib/tests/BusinessActivities.test.js +14 -85
- package/lib/tests/BusinessActivities.test.js.map +1 -1
- package/lib/tests/ContactGroups.test.js +14 -92
- package/lib/tests/ContactGroups.test.js.map +1 -1
- package/lib/tests/ContactRelations.test.js +14 -87
- package/lib/tests/ContactRelations.test.js.map +1 -1
- package/lib/tests/ContactSectors.test.js +14 -124
- package/lib/tests/ContactSectors.test.js.map +1 -1
- package/lib/tests/ContactTypes.test.js +14 -118
- package/lib/tests/ContactTypes.test.js.map +1 -1
- package/lib/tests/Contacts.test.js +23 -0
- package/lib/tests/Contacts.test.js.map +1 -0
- package/lib/tests/Expenses.test.js +14 -98
- package/lib/tests/Expenses.test.js.map +1 -1
- package/lib/tests/Invoices.test.d.ts +1 -0
- package/lib/tests/Invoices.test.js +23 -0
- package/lib/tests/Invoices.test.js.map +1 -0
- package/lib/tests/Items.test.d.ts +1 -0
- package/lib/tests/Items.test.js +23 -0
- package/lib/tests/Items.test.js.map +1 -0
- package/lib/tests/Orders.test.js +14 -127
- package/lib/tests/Orders.test.js.map +1 -1
- package/lib/tests/Payments.test.js +15 -90
- package/lib/tests/Payments.test.js.map +1 -1
- package/lib/tests/ProjectStatuses.test.js +14 -123
- package/lib/tests/ProjectStatuses.test.js.map +1 -1
- package/lib/tests/ProjectTypes.test.js +14 -119
- package/lib/tests/ProjectTypes.test.js.map +1 -1
- package/lib/tests/Projects.test.js +14 -91
- package/lib/tests/Projects.test.js.map +1 -1
- package/lib/tests/TimetrackingStatuses.test.js +14 -123
- package/lib/tests/TimetrackingStatuses.test.js.map +1 -1
- package/lib/tests/Timetrackings.test.js +14 -102
- package/lib/tests/Timetrackings.test.js.map +1 -1
- package/lib/tests/Users.test.js +14 -125
- package/lib/tests/Users.test.js.map +1 -1
- package/package.json +45 -29
- package/lib/constants/Scopes.d.ts +0 -32
- package/lib/constants/Scopes.js +0 -36
- package/lib/constants/Scopes.js.map +0 -1
- package/lib/libs/OAuth2.d.ts +0 -122
- package/lib/libs/OAuth2.js +0 -202
- package/lib/libs/OAuth2.js.map +0 -1
- package/lib/tests/Authentication.test.js +0 -83
- package/lib/tests/Authentication.test.js.map +0 -1
- package/lib/tests/Contact.test.js +0 -103
- package/lib/tests/Contact.test.js.map +0 -1
- /package/lib/tests/{Authentication.test.d.ts → BaseCrud.test.d.ts} +0 -0
- /package/lib/tests/{Contact.test.d.ts → Contacts.test.d.ts} +0 -0
|
@@ -1,96 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
12
|
-
if (mod && mod.__esModule) return mod;
|
|
13
|
-
var result = {};
|
|
14
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
15
|
-
result["default"] = mod;
|
|
16
|
-
return result;
|
|
17
|
-
};
|
|
18
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
19
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
20
4
|
};
|
|
21
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
const
|
|
23
|
-
const
|
|
6
|
+
const BaseCrud_1 = __importDefault(require("../resources/BaseCrud"));
|
|
7
|
+
const utils_1 = require("ts-jest/utils");
|
|
24
8
|
const ContactRelations_1 = __importDefault(require("../resources/ContactRelations"));
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
!BEXIO_CLIENTSECRET ||
|
|
38
|
-
!HOSTNAME ||
|
|
39
|
-
!BEXIO_USERNAME ||
|
|
40
|
-
!BEXIO_PASSWORD)
|
|
41
|
-
throw new Error("not all necessary variables defined");
|
|
42
|
-
api = new __1.default(BEXIO_CLIENTID, BEXIO_CLIENTSECRET, `http://${HOSTNAME}/callback`, [__1.Scopes.CONTACT_SHOW, __1.Scopes.CONTACT_EDIT]);
|
|
43
|
-
yield api.fakeLogin(BEXIO_USERNAME, BEXIO_PASSWORD);
|
|
44
|
-
}));
|
|
45
|
-
it("init ContactRelations object", () => {
|
|
46
|
-
moduleToTest = new ContactRelations_1.default(api["bexioAuth"]);
|
|
9
|
+
const chance_1 = __importDefault(require("chance"));
|
|
10
|
+
jest.mock("../resources/BaseCrud");
|
|
11
|
+
const mockedBase = (0, utils_1.mocked)(BaseCrud_1.default, true);
|
|
12
|
+
const seedgenerator = new chance_1.default();
|
|
13
|
+
const seed = seedgenerator.hash();
|
|
14
|
+
console.log(`using chance seed ${seed}`);
|
|
15
|
+
const chance = new chance_1.default(seed);
|
|
16
|
+
describe("ContactRelations", () => {
|
|
17
|
+
it("Should use init the base correctly", () => {
|
|
18
|
+
const token = chance.string();
|
|
19
|
+
new ContactRelations_1.default(token);
|
|
20
|
+
expect(mockedBase).toHaveBeenCalledWith(token, "/contact_relation");
|
|
47
21
|
});
|
|
48
|
-
it("create new contact relation", () => __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
const description = `test-${Date.now()}`;
|
|
50
|
-
contactRelation = yield moduleToTest.create({
|
|
51
|
-
contact_id: 1,
|
|
52
|
-
contact_sub_id: 2,
|
|
53
|
-
description
|
|
54
|
-
});
|
|
55
|
-
chai_1.expect(contactRelation.description).to.be.eq(description);
|
|
56
|
-
}));
|
|
57
|
-
it("list contact relation", () => __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
const list = yield moduleToTest.list({});
|
|
59
|
-
chai_1.expect(list.map(el => el.id)).includes(contactRelation.id);
|
|
60
|
-
}));
|
|
61
|
-
it("search contact relation", () => __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
const searchResult = yield moduleToTest.search({}, [
|
|
63
|
-
{
|
|
64
|
-
field: ContactRelationsStatic_1.ContactRelationsStatic.ContactRelationSearchParameters.contact_id,
|
|
65
|
-
value: 1,
|
|
66
|
-
criteria: "="
|
|
67
|
-
}
|
|
68
|
-
]);
|
|
69
|
-
chai_1.expect(searchResult.length).to.be.eq(1);
|
|
70
|
-
chai_1.expect(searchResult[0].id).to.be.eq(contactRelation.id);
|
|
71
|
-
}));
|
|
72
|
-
it("show contact relation", () => __awaiter(this, void 0, void 0, function* () {
|
|
73
|
-
const show = yield moduleToTest.show({}, contactRelation.id);
|
|
74
|
-
chai_1.expect(show.id).to.be.eq(contactRelation.id);
|
|
75
|
-
}));
|
|
76
|
-
it("overwrite contact relation", () => __awaiter(this, void 0, void 0, function* () {
|
|
77
|
-
const overwritten = yield moduleToTest.overwrite(contactRelation.id, {
|
|
78
|
-
contact_id: 1,
|
|
79
|
-
contact_sub_id: 2,
|
|
80
|
-
description: `overwritten-${Date.now()}`
|
|
81
|
-
});
|
|
82
|
-
chai_1.expect(overwritten.description).include("overwritten-");
|
|
83
|
-
}));
|
|
84
|
-
it("edit contact relation", () => __awaiter(this, void 0, void 0, function* () {
|
|
85
|
-
const edited = yield moduleToTest.edit(contactRelation.id, {
|
|
86
|
-
contact_id: contactRelation.contact_id,
|
|
87
|
-
description: `edited-${Date.now()}`
|
|
88
|
-
});
|
|
89
|
-
chai_1.expect(edited.description).include("edited-");
|
|
90
|
-
}));
|
|
91
|
-
it("delete contact relation", () => __awaiter(this, void 0, void 0, function* () {
|
|
92
|
-
const result = yield moduleToTest.delete(contactRelation.id);
|
|
93
|
-
chai_1.expect(result).to.be.true;
|
|
94
|
-
}));
|
|
95
22
|
});
|
|
96
23
|
//# sourceMappingURL=ContactRelations.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContactRelations.test.js","sourceRoot":"","sources":["../../src/tests/ContactRelations.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ContactRelations.test.js","sourceRoot":"","sources":["../../src/tests/ContactRelations.test.ts"],"names":[],"mappings":";;;;;AAAA,qEAA6C;AAC7C,yCAAuC;AACvC,qFAA6D;AAC7D,oDAA4B;AAE5B,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;AACnC,MAAM,UAAU,GAAG,IAAA,cAAM,EAAC,kBAAQ,EAAE,IAAI,CAAC,CAAC;AAE1C,MAAM,aAAa,GAAG,IAAI,gBAAM,EAAE,CAAC;AACnC,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC;AAClC,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC;AACzC,MAAM,MAAM,GAAG,IAAI,gBAAM,CAAC,IAAI,CAAC,CAAC;AAEhC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;QAC9B,IAAI,0BAAgB,CAAC,KAAK,CAAC,CAAC;QAC5B,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,133 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
12
|
-
if (mod && mod.__esModule) return mod;
|
|
13
|
-
var result = {};
|
|
14
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
15
|
-
result["default"] = mod;
|
|
16
|
-
return result;
|
|
17
|
-
};
|
|
18
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
19
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
20
4
|
};
|
|
21
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
const
|
|
23
|
-
const
|
|
6
|
+
const BaseCrud_1 = __importDefault(require("../resources/BaseCrud"));
|
|
7
|
+
const utils_1 = require("ts-jest/utils");
|
|
24
8
|
const ContactSectors_1 = __importDefault(require("../resources/ContactSectors"));
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const { BEXIO_CLIENTID, BEXIO_CLIENTSECRET, HOSTNAME, BEXIO_USERNAME, BEXIO_PASSWORD } = process.env;
|
|
38
|
-
before(() => __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
if (!BEXIO_CLIENTID ||
|
|
40
|
-
!BEXIO_CLIENTSECRET ||
|
|
41
|
-
!HOSTNAME ||
|
|
42
|
-
!BEXIO_USERNAME ||
|
|
43
|
-
!BEXIO_PASSWORD)
|
|
44
|
-
throw new Error("not all necessary variables defined");
|
|
45
|
-
api = new __1.default(BEXIO_CLIENTID, BEXIO_CLIENTSECRET, `http://${HOSTNAME}/callback`, [__1.Scopes.CONTACT_SHOW, __1.Scopes.CONTACT_EDIT]);
|
|
46
|
-
yield api.fakeLogin(BEXIO_USERNAME, BEXIO_PASSWORD);
|
|
47
|
-
}));
|
|
48
|
-
it("init ContactSectors object", () => {
|
|
49
|
-
moduleToTest = new ContactSectors_1.default(api["bexioAuth"]);
|
|
9
|
+
const chance_1 = __importDefault(require("chance"));
|
|
10
|
+
jest.mock("../resources/BaseCrud");
|
|
11
|
+
const mockedBase = (0, utils_1.mocked)(BaseCrud_1.default, true);
|
|
12
|
+
const seedgenerator = new chance_1.default();
|
|
13
|
+
const seed = seedgenerator.hash();
|
|
14
|
+
console.log(`using chance seed ${seed}`);
|
|
15
|
+
const chance = new chance_1.default(seed);
|
|
16
|
+
describe("ContactSectors", () => {
|
|
17
|
+
it("Should use init the base correctly", () => {
|
|
18
|
+
const token = chance.string();
|
|
19
|
+
new ContactSectors_1.default(token);
|
|
20
|
+
expect(mockedBase).toHaveBeenCalledWith(token, "/contact_branch");
|
|
50
21
|
});
|
|
51
|
-
it.skip("create new contact sector (not implemented by Bexio yet)", () => __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
contactSector = yield moduleToTest.create({
|
|
53
|
-
id: 1,
|
|
54
|
-
name: `sector-${Date.now()}`
|
|
55
|
-
});
|
|
56
|
-
chai_1.expect(contactSector.name).include("sector-");
|
|
57
|
-
}));
|
|
58
|
-
it("should return a not implemented error on creation", () => __awaiter(this, void 0, void 0, function* () {
|
|
59
|
-
try {
|
|
60
|
-
yield moduleToTest.create({ id: 1, name: `sector-${Date.now()}` });
|
|
61
|
-
}
|
|
62
|
-
catch (err) {
|
|
63
|
-
chai_1.expect(err.message).to.be.eq("not implemented by Bexio yet");
|
|
64
|
-
}
|
|
65
|
-
}));
|
|
66
|
-
it("list contact sectors", () => __awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
const list = yield moduleToTest.list({});
|
|
68
|
-
chai_1.expect(list.map(el => el.id)).includes(contactSector.id);
|
|
69
|
-
}));
|
|
70
|
-
it("search contact sector", () => __awaiter(this, void 0, void 0, function* () {
|
|
71
|
-
const searchResult = yield moduleToTest.search({}, [
|
|
72
|
-
{
|
|
73
|
-
field: ContactSectorsStatic_1.ContactSectorsStatic.ContactSectorSearchParameters.name,
|
|
74
|
-
value: contactSector.name,
|
|
75
|
-
criteria: "="
|
|
76
|
-
}
|
|
77
|
-
]);
|
|
78
|
-
chai_1.expect(searchResult.length).to.be.eq(1);
|
|
79
|
-
chai_1.expect(searchResult[0].id).to.be.eq(contactSector.id);
|
|
80
|
-
}));
|
|
81
|
-
it("show contact sector", () => __awaiter(this, void 0, void 0, function* () {
|
|
82
|
-
const show = yield moduleToTest.show({}, contactSector.id);
|
|
83
|
-
chai_1.expect(show.id).to.be.eq(contactSector.id);
|
|
84
|
-
chai_1.expect(show.name).to.be.eq(contactSector.name);
|
|
85
|
-
}));
|
|
86
|
-
it.skip("overwrite contact sector (not implemented by Bexio yet)", () => __awaiter(this, void 0, void 0, function* () {
|
|
87
|
-
const overwritten = yield moduleToTest.overwrite(contactSector.id, {
|
|
88
|
-
name: `overwritten-${Date.now()}`,
|
|
89
|
-
id: 1
|
|
90
|
-
});
|
|
91
|
-
chai_1.expect(overwritten.name).include("overwritten");
|
|
92
|
-
}));
|
|
93
|
-
it("should return a not implemented error on overwrite", () => __awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
try {
|
|
95
|
-
const overwritten = yield moduleToTest.overwrite(contactSector.id, {
|
|
96
|
-
name: `overwritten-${Date.now()}`,
|
|
97
|
-
id: 1
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
catch (err) {
|
|
101
|
-
chai_1.expect(err.message).to.be.eq("not implemented by Bexio yet");
|
|
102
|
-
}
|
|
103
|
-
}));
|
|
104
|
-
it.skip("edit contact sector (not implemented by Bexio yet)", () => __awaiter(this, void 0, void 0, function* () {
|
|
105
|
-
const edited = yield moduleToTest.edit(contactSector.id, {
|
|
106
|
-
name: `edited-${Date.now()}`
|
|
107
|
-
});
|
|
108
|
-
chai_1.expect(edited.name).include("edited-");
|
|
109
|
-
}));
|
|
110
|
-
it("should return a not implemented error on edit", () => __awaiter(this, void 0, void 0, function* () {
|
|
111
|
-
try {
|
|
112
|
-
const edited = yield moduleToTest.edit(contactSector.id, {
|
|
113
|
-
name: `edited-${Date.now()}`
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
catch (err) {
|
|
117
|
-
chai_1.expect(err.message).to.be.eq("not implemented by Bexio yet");
|
|
118
|
-
}
|
|
119
|
-
}));
|
|
120
|
-
it.skip("delete contact sector (not implemented by Bexio yet)", () => __awaiter(this, void 0, void 0, function* () {
|
|
121
|
-
const result = yield moduleToTest.delete(contactSector.id);
|
|
122
|
-
chai_1.expect(result).to.be.true;
|
|
123
|
-
}));
|
|
124
|
-
it("should return a not implemented error on deletion", () => __awaiter(this, void 0, void 0, function* () {
|
|
125
|
-
try {
|
|
126
|
-
const result = yield moduleToTest.delete(contactSector.id);
|
|
127
|
-
}
|
|
128
|
-
catch (err) {
|
|
129
|
-
chai_1.expect(err.message).to.be.eq("not implemented by Bexio yet");
|
|
130
|
-
}
|
|
131
|
-
}));
|
|
132
22
|
});
|
|
133
23
|
//# sourceMappingURL=ContactSectors.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContactSectors.test.js","sourceRoot":"","sources":["../../src/tests/ContactSectors.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ContactSectors.test.js","sourceRoot":"","sources":["../../src/tests/ContactSectors.test.ts"],"names":[],"mappings":";;;;;AAAA,qEAA6C;AAC7C,yCAAuC;AACvC,iFAAyD;AACzD,oDAA4B;AAE5B,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;AACnC,MAAM,UAAU,GAAG,IAAA,cAAM,EAAC,kBAAQ,EAAE,IAAI,CAAC,CAAC;AAE1C,MAAM,aAAa,GAAG,IAAI,gBAAM,EAAE,CAAC;AACnC,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC;AAClC,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC;AACzC,MAAM,MAAM,GAAG,IAAI,gBAAM,CAAC,IAAI,CAAC,CAAC;AAEhC,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;QAC9B,IAAI,wBAAc,CAAC,KAAK,CAAC,CAAC;QAC1B,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,127 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
12
|
-
if (mod && mod.__esModule) return mod;
|
|
13
|
-
var result = {};
|
|
14
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
15
|
-
result["default"] = mod;
|
|
16
|
-
return result;
|
|
17
|
-
};
|
|
18
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
19
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
20
4
|
};
|
|
21
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
const
|
|
23
|
-
const
|
|
6
|
+
const BaseCrud_1 = __importDefault(require("../resources/BaseCrud"));
|
|
7
|
+
const utils_1 = require("ts-jest/utils");
|
|
24
8
|
const ContactTypes_1 = __importDefault(require("../resources/ContactTypes"));
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
!BEXIO_CLIENTSECRET ||
|
|
38
|
-
!HOSTNAME ||
|
|
39
|
-
!BEXIO_USERNAME ||
|
|
40
|
-
!BEXIO_PASSWORD)
|
|
41
|
-
throw new Error("not all necessary variables defined");
|
|
42
|
-
api = new __1.default(BEXIO_CLIENTID, BEXIO_CLIENTSECRET, `http://${HOSTNAME}/callback`, [__1.Scopes.CONTACT_SHOW, __1.Scopes.CONTACT_EDIT]);
|
|
43
|
-
yield api.fakeLogin(BEXIO_USERNAME, BEXIO_PASSWORD);
|
|
44
|
-
}));
|
|
45
|
-
it("init ContactTypes object", () => {
|
|
46
|
-
moduleToTest = new ContactTypes_1.default(api["bexioAuth"]);
|
|
9
|
+
const chance_1 = __importDefault(require("chance"));
|
|
10
|
+
jest.mock("../resources/BaseCrud");
|
|
11
|
+
const mockedBase = (0, utils_1.mocked)(BaseCrud_1.default, true);
|
|
12
|
+
const seedgenerator = new chance_1.default();
|
|
13
|
+
const seed = seedgenerator.hash();
|
|
14
|
+
console.log(`using chance seed ${seed}`);
|
|
15
|
+
const chance = new chance_1.default(seed);
|
|
16
|
+
describe("ContactTypes", () => {
|
|
17
|
+
it("Should use init the base correctly", () => {
|
|
18
|
+
const token = chance.string();
|
|
19
|
+
new ContactTypes_1.default(token);
|
|
20
|
+
expect(mockedBase).toHaveBeenCalledWith(token, "/contact_type");
|
|
47
21
|
});
|
|
48
|
-
it.skip("create new contact type (not implemented by Bexio yet)", () => __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
contactType = yield moduleToTest.create({ name: `type-${Date.now()}` });
|
|
50
|
-
chai_1.expect(contactType.name).include("type-");
|
|
51
|
-
}));
|
|
52
|
-
it("should return a not implemented error on creation", () => __awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
try {
|
|
54
|
-
contactType = yield moduleToTest.create({ name: `type-${Date.now()}` });
|
|
55
|
-
}
|
|
56
|
-
catch (err) {
|
|
57
|
-
chai_1.expect(err.message).to.be.eq("not implemented by Bexio yet");
|
|
58
|
-
}
|
|
59
|
-
}));
|
|
60
|
-
it("list contact types", () => __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
const list = yield moduleToTest.list({});
|
|
62
|
-
chai_1.expect(list.map(el => el.id)).includes(contactType.id);
|
|
63
|
-
}));
|
|
64
|
-
it("search contact type", () => __awaiter(this, void 0, void 0, function* () {
|
|
65
|
-
const searchResult = yield moduleToTest.search({}, [
|
|
66
|
-
{
|
|
67
|
-
field: ContactTypesStatic_1.ContactTypesStatic.ContactTypeSearchParameters.name,
|
|
68
|
-
value: contactType.name,
|
|
69
|
-
criteria: "="
|
|
70
|
-
}
|
|
71
|
-
]);
|
|
72
|
-
chai_1.expect(searchResult.length).to.be.eq(1);
|
|
73
|
-
chai_1.expect(searchResult[0].id).to.be.eq(contactType.id);
|
|
74
|
-
}));
|
|
75
|
-
it("show contact type", () => __awaiter(this, void 0, void 0, function* () {
|
|
76
|
-
const show = yield moduleToTest.show({}, contactType.id);
|
|
77
|
-
chai_1.expect(show.id).to.be.eq(contactType.id);
|
|
78
|
-
chai_1.expect(show.name).to.be.eq(contactType.name);
|
|
79
|
-
}));
|
|
80
|
-
it.skip("overwrite contact type (not implemented by Bexio yet)", () => __awaiter(this, void 0, void 0, function* () {
|
|
81
|
-
const overwritten = yield moduleToTest.overwrite(contactType.id, {
|
|
82
|
-
name: `overwritten-${Date.now()}`,
|
|
83
|
-
id: 1
|
|
84
|
-
});
|
|
85
|
-
chai_1.expect(overwritten.name).include("overwritten");
|
|
86
|
-
}));
|
|
87
|
-
it("should return a not implemented error on overwrite", () => __awaiter(this, void 0, void 0, function* () {
|
|
88
|
-
try {
|
|
89
|
-
const overwritten = yield moduleToTest.overwrite(contactType.id, {
|
|
90
|
-
name: `overwritten-${Date.now()}`,
|
|
91
|
-
id: 1
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
catch (err) {
|
|
95
|
-
chai_1.expect(err.message).to.be.eq("not implemented by Bexio yet");
|
|
96
|
-
}
|
|
97
|
-
}));
|
|
98
|
-
it.skip("edit contact type (not implemented by Bexio yet)", () => __awaiter(this, void 0, void 0, function* () {
|
|
99
|
-
const edited = yield moduleToTest.edit(contactType.id, {
|
|
100
|
-
name: `edited-${Date.now()}`
|
|
101
|
-
});
|
|
102
|
-
chai_1.expect(edited.name).include("edited-");
|
|
103
|
-
}));
|
|
104
|
-
it("should return a not implemented error on edit", () => __awaiter(this, void 0, void 0, function* () {
|
|
105
|
-
try {
|
|
106
|
-
const edited = yield moduleToTest.edit(contactType.id, {
|
|
107
|
-
name: `edited-${Date.now()}`
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
catch (err) {
|
|
111
|
-
chai_1.expect(err.message).to.be.eq("not implemented by Bexio yet");
|
|
112
|
-
}
|
|
113
|
-
}));
|
|
114
|
-
it.skip("delete contact type (not implemented by Bexio yet)", () => __awaiter(this, void 0, void 0, function* () {
|
|
115
|
-
const result = yield moduleToTest.delete(contactType.id);
|
|
116
|
-
chai_1.expect(result).to.be.true;
|
|
117
|
-
}));
|
|
118
|
-
it("should return a not implemented error on delete", () => __awaiter(this, void 0, void 0, function* () {
|
|
119
|
-
try {
|
|
120
|
-
const result = yield moduleToTest.delete(contactType.id);
|
|
121
|
-
}
|
|
122
|
-
catch (err) {
|
|
123
|
-
chai_1.expect(err.message).to.be.eq("not implemented by Bexio yet");
|
|
124
|
-
}
|
|
125
|
-
}));
|
|
126
22
|
});
|
|
127
23
|
//# sourceMappingURL=ContactTypes.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContactTypes.test.js","sourceRoot":"","sources":["../../src/tests/ContactTypes.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ContactTypes.test.js","sourceRoot":"","sources":["../../src/tests/ContactTypes.test.ts"],"names":[],"mappings":";;;;;AAAA,qEAA6C;AAC7C,yCAAuC;AACvC,6EAAqD;AACrD,oDAA4B;AAE5B,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;AACnC,MAAM,UAAU,GAAG,IAAA,cAAM,EAAC,kBAAQ,EAAE,IAAI,CAAC,CAAC;AAE1C,MAAM,aAAa,GAAG,IAAI,gBAAM,EAAE,CAAC;AACnC,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC;AAClC,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC;AACzC,MAAM,MAAM,GAAG,IAAI,gBAAM,CAAC,IAAI,CAAC,CAAC;AAEhC,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;QAC9B,IAAI,sBAAY,CAAC,KAAK,CAAC,CAAC;QACxB,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const BaseCrud_1 = __importDefault(require("../resources/BaseCrud"));
|
|
7
|
+
const utils_1 = require("ts-jest/utils");
|
|
8
|
+
const Contacts_1 = __importDefault(require("../resources/Contacts"));
|
|
9
|
+
const chance_1 = __importDefault(require("chance"));
|
|
10
|
+
jest.mock("../resources/BaseCrud");
|
|
11
|
+
const mockedBase = (0, utils_1.mocked)(BaseCrud_1.default, true);
|
|
12
|
+
const seedgenerator = new chance_1.default();
|
|
13
|
+
const seed = seedgenerator.hash();
|
|
14
|
+
console.log(`using chance seed ${seed}`);
|
|
15
|
+
const chance = new chance_1.default(seed);
|
|
16
|
+
describe("Contacts", () => {
|
|
17
|
+
it("Should use init the base correctly", () => {
|
|
18
|
+
const token = chance.string();
|
|
19
|
+
new Contacts_1.default(token);
|
|
20
|
+
expect(mockedBase).toHaveBeenCalledWith(token, "/contact");
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=Contacts.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Contacts.test.js","sourceRoot":"","sources":["../../src/tests/Contacts.test.ts"],"names":[],"mappings":";;;;;AAAA,qEAA6C;AAC7C,yCAAuC;AACvC,qEAA6C;AAC7C,oDAA4B;AAE5B,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;AACnC,MAAM,UAAU,GAAG,IAAA,cAAM,EAAC,kBAAQ,EAAE,IAAI,CAAC,CAAC;AAE1C,MAAM,aAAa,GAAG,IAAI,gBAAM,EAAE,CAAC;AACnC,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC;AAClC,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC;AACzC,MAAM,MAAM,GAAG,IAAI,gBAAM,CAAC,IAAI,CAAC,CAAC;AAEhC,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;QAC9B,IAAI,kBAAQ,CAAC,KAAK,CAAC,CAAC;QACpB,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,107 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
12
|
-
if (mod && mod.__esModule) return mod;
|
|
13
|
-
var result = {};
|
|
14
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
15
|
-
result["default"] = mod;
|
|
16
|
-
return result;
|
|
17
|
-
};
|
|
18
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
19
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
20
4
|
};
|
|
21
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
const
|
|
23
|
-
const
|
|
6
|
+
const BaseCrud_1 = __importDefault(require("../resources/BaseCrud"));
|
|
7
|
+
const utils_1 = require("ts-jest/utils");
|
|
24
8
|
const Expenses_1 = __importDefault(require("../resources/Expenses"));
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
!BEXIO_CLIENTSECRET ||
|
|
38
|
-
!HOSTNAME ||
|
|
39
|
-
!BEXIO_USERNAME ||
|
|
40
|
-
!BEXIO_PASSWORD)
|
|
41
|
-
throw new Error("not all necessary variables defined");
|
|
42
|
-
api = new __1.default(BEXIO_CLIENTID, BEXIO_CLIENTSECRET, `http://${HOSTNAME}/callback`, [__1.Scopes.KB_EXPENSE_EDIT, __1.Scopes.KB_EXPENSE_SHOW]);
|
|
43
|
-
yield api.fakeLogin(BEXIO_USERNAME, BEXIO_PASSWORD);
|
|
44
|
-
}));
|
|
45
|
-
it("init Expenses object", () => {
|
|
46
|
-
moduleToTest = new Expenses_1.default(api["bexioAuth"]);
|
|
9
|
+
const chance_1 = __importDefault(require("chance"));
|
|
10
|
+
jest.mock("../resources/BaseCrud");
|
|
11
|
+
const mockedBase = (0, utils_1.mocked)(BaseCrud_1.default, true);
|
|
12
|
+
const seedgenerator = new chance_1.default();
|
|
13
|
+
const seed = seedgenerator.hash();
|
|
14
|
+
console.log(`using chance seed ${seed}`);
|
|
15
|
+
const chance = new chance_1.default(seed);
|
|
16
|
+
describe("Expenses", () => {
|
|
17
|
+
it("Should use init the base correctly", () => {
|
|
18
|
+
const token = chance.string();
|
|
19
|
+
new Expenses_1.default(token);
|
|
20
|
+
expect(mockedBase).toHaveBeenCalledWith(token, "/kb_expense");
|
|
47
21
|
});
|
|
48
|
-
it("create new expense", () => __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
expense = yield moduleToTest.create({
|
|
50
|
-
account_id: 90,
|
|
51
|
-
amount: "99",
|
|
52
|
-
contact_id: 1,
|
|
53
|
-
tax_id: 7,
|
|
54
|
-
user_id: 1,
|
|
55
|
-
mwst_type: 2
|
|
56
|
-
});
|
|
57
|
-
}));
|
|
58
|
-
it("list expenses", () => __awaiter(this, void 0, void 0, function* () {
|
|
59
|
-
const list = yield moduleToTest.list({});
|
|
60
|
-
chai_1.expect(list.map(el => el.id)).includes(expense.id);
|
|
61
|
-
}));
|
|
62
|
-
it("search expense", () => __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
const searchResult = yield moduleToTest.search({}, [
|
|
64
|
-
{
|
|
65
|
-
field: ExpensesStatic_1.ExpensesStatic.SearchParameters.id,
|
|
66
|
-
value: expense.id,
|
|
67
|
-
criteria: "="
|
|
68
|
-
}
|
|
69
|
-
]);
|
|
70
|
-
chai_1.expect(searchResult.length).to.be.eq(1);
|
|
71
|
-
chai_1.expect(searchResult[0].id).to.be.eq(expense.id);
|
|
72
|
-
}));
|
|
73
|
-
it("show expense", () => __awaiter(this, void 0, void 0, function* () {
|
|
74
|
-
const show = yield moduleToTest.show({}, expense.id);
|
|
75
|
-
chai_1.expect(show.id).to.be.eq(expense.id);
|
|
76
|
-
}));
|
|
77
|
-
it("overwrite expense", () => __awaiter(this, void 0, void 0, function* () {
|
|
78
|
-
const overwritten = yield moduleToTest.overwrite(expense.id, {
|
|
79
|
-
account_id: 99,
|
|
80
|
-
amount: "99",
|
|
81
|
-
contact_id: 1,
|
|
82
|
-
tax_id: 7,
|
|
83
|
-
user_id: 1,
|
|
84
|
-
mwst_type: 2,
|
|
85
|
-
bank_account_id: 1,
|
|
86
|
-
currency_id: 1,
|
|
87
|
-
is_compact_view: false,
|
|
88
|
-
is_valid_from: Date.now(),
|
|
89
|
-
language_id: 1,
|
|
90
|
-
logopaper_id: 1,
|
|
91
|
-
nb_decimals_amount: 99,
|
|
92
|
-
nb_decimals_price: 2,
|
|
93
|
-
payment_type_id: 1,
|
|
94
|
-
show_position_taxes: true
|
|
95
|
-
});
|
|
96
|
-
chai_1.expect(overwritten.account_id).to.be.eq(99);
|
|
97
|
-
}));
|
|
98
|
-
it("edit expense", () => __awaiter(this, void 0, void 0, function* () {
|
|
99
|
-
const edited = yield moduleToTest.edit(expense.id, { amount: "88" });
|
|
100
|
-
chai_1.expect(edited.amount).to.be.eq("88");
|
|
101
|
-
}));
|
|
102
|
-
it("delete expense", () => __awaiter(this, void 0, void 0, function* () {
|
|
103
|
-
const result = yield moduleToTest.delete(expense.id);
|
|
104
|
-
chai_1.expect(result).to.be.true;
|
|
105
|
-
}));
|
|
106
22
|
});
|
|
107
23
|
//# sourceMappingURL=Expenses.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Expenses.test.js","sourceRoot":"","sources":["../../src/tests/Expenses.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Expenses.test.js","sourceRoot":"","sources":["../../src/tests/Expenses.test.ts"],"names":[],"mappings":";;;;;AAAA,qEAA6C;AAC7C,yCAAuC;AACvC,qEAA6C;AAC7C,oDAA4B;AAE5B,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;AACnC,MAAM,UAAU,GAAG,IAAA,cAAM,EAAC,kBAAQ,EAAE,IAAI,CAAC,CAAC;AAE1C,MAAM,aAAa,GAAG,IAAI,gBAAM,EAAE,CAAC;AACnC,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC;AAClC,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC;AACzC,MAAM,MAAM,GAAG,IAAI,gBAAM,CAAC,IAAI,CAAC,CAAC;AAEhC,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;QAC9B,IAAI,kBAAQ,CAAC,KAAK,CAAC,CAAC;QACpB,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|