btrz-api-client 8.65.0 → 8.66.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/.eslint-report.json +1 -0
- package/.eslintignore +2 -0
- package/fetch-test.js +5 -6
- package/index.js +2 -2
- package/lib/client-standalone-min.js +3 -3
- package/lib/client.js +50 -38
- package/lib/endpoints/accounts/journey-prices-settings.js +2 -2
- package/lib/endpoints/accounts/market-pricing-settings.js +3 -3
- package/lib/endpoints/accounts/multiproduct-sales-settings.js +6 -2
- package/lib/endpoints/accounts/operation-settings.js +3 -1
- package/lib/endpoints/btrzpay/referenced-payments.js +6 -2
- package/lib/endpoints/btrzpay/square.js +12 -3
- package/lib/endpoints/btrzpay/stripe-terminals.js +9 -3
- package/lib/endpoints/btrzpay/terminalPayments.js +14 -4
- package/lib/endpoints/inventory/document-types.js +2 -1
- package/lib/endpoints/inventory/products.js +1 -0
- package/lib/endpoints/operations/movements.js +7 -2
- package/lib/endpoints/operations/pago-express.js +9 -3
- package/lib/endpoints/operations/parcels.js +3 -1
- package/lib/endpoints/sales/cancellations.js +31 -8
- package/package.json +6 -8
- package/src/client.js +0 -1
- package/src/endpoints/accounts/journey-prices-settings.js +2 -2
- package/src/endpoints/accounts/market-pricing-settings.js +3 -3
- package/src/endpoints/accounts/multiproduct-sales-settings.js +6 -2
- package/src/endpoints/accounts/operation-settings.js +3 -1
- package/src/endpoints/btrzpay/referenced-payments.js +6 -2
- package/src/endpoints/btrzpay/square.js +12 -3
- package/src/endpoints/btrzpay/stripe-terminals.js +9 -3
- package/src/endpoints/btrzpay/terminalPayments.js +14 -4
- package/src/endpoints/inventory/document-types.js +2 -1
- package/src/endpoints/inventory/products.js +1 -0
- package/src/endpoints/operations/movements.js +7 -2
- package/src/endpoints/operations/pago-express.js +9 -3
- package/src/endpoints/operations/parcels.js +3 -1
- package/src/endpoints/sales/cancellations.js +31 -8
- package/test/all.test.js +218 -0
- package/test/client.test.js +58 -44
- package/test/endpoints/accounts/application-settings.test.js +2 -2
- package/test/endpoints/accounts/applications.test.js +2 -2
- package/test/endpoints/accounts/current-shifts.test.js +2 -2
- package/test/endpoints/accounts/customers.js +17 -17
- package/test/endpoints/accounts/domains.test.js +6 -8
- package/test/endpoints/accounts/exchange-rates.test.js +3 -3
- package/test/endpoints/accounts/exchange-receipts.test.js +3 -3
- package/test/endpoints/accounts/images.test.js +2 -2
- package/test/endpoints/accounts/interline.test.js +10 -12
- package/test/endpoints/accounts/network.test.js +3 -5
- package/test/endpoints/accounts/people-lookups.test.js +13 -13
- package/test/endpoints/accounts/print-templates.test.js +3 -3
- package/test/endpoints/accounts/printers.test.js +2 -2
- package/test/endpoints/accounts/tokens.js +2 -2
- package/test/endpoints/accounts/trusted-machines.test.js +2 -2
- package/test/endpoints/accounts/websales-config.test.js +47 -50
- package/test/endpoints/btrzpay/carpointe.tests.js +2 -2
- package/test/endpoints/btrzpay/datalogicPayments.tests.js +2 -2
- package/test/endpoints/btrzpay/datalogicReferenceNumber.tests.js +2 -2
- package/test/endpoints/btrzpay/oxxoPayments.tests.js +2 -2
- package/test/endpoints/btrzpay/oxxoToken.tests.js +2 -2
- package/test/endpoints/btrzpay/payment-methods.test.js +3 -3
- package/test/endpoints/btrzpay/payments.tests.js +6 -6
- package/test/endpoints/btrzpay/reference-numbers.test.js +5 -5
- package/test/endpoints/btrzpay/referenced-payments.test.js +2 -2
- package/test/endpoints/btrzpay/square.tests.js +2 -2
- package/test/endpoints/btrzpay/terminalPayments.tests.js +2 -2
- package/test/endpoints/endpoints_helpers.test.js +28 -24
- package/test/endpoints/inventory/amenities.test.js +20 -20
- package/test/endpoints/inventory/amenity-groups.test.js +15 -15
- package/test/endpoints/inventory/bare-routes.test.js +2 -2
- package/test/endpoints/inventory/brands.test.js +9 -9
- package/test/endpoints/inventory/bundle-fares.test.js +10 -11
- package/test/endpoints/inventory/bundles.test.js +9 -9
- package/test/endpoints/inventory/companies.test.js +6 -6
- package/test/endpoints/inventory/custom-content.test.js +4 -4
- package/test/endpoints/inventory/custom-fields.test.js +2 -2
- package/test/endpoints/inventory/document-types.test.js +2 -2
- package/test/endpoints/inventory/fare-classes.test.js +10 -10
- package/test/endpoints/inventory/fares.test.js +14 -16
- package/test/endpoints/inventory/fees.test.js +14 -15
- package/test/endpoints/inventory/filtered-trips-v2.test.js +5 -5
- package/test/endpoints/inventory/insurances.test.js +2 -2
- package/test/endpoints/inventory/insurancesCost.test.js +2 -2
- package/test/endpoints/inventory/journey-prices.test.js +13 -15
- package/test/endpoints/inventory/labels.test.js +2 -2
- package/test/endpoints/inventory/marital-status.test.js +2 -2
- package/test/endpoints/inventory/mit-terminal-settings.test.js +2 -2
- package/test/endpoints/inventory/mit-terminals.test.js +7 -7
- package/test/endpoints/inventory/operating-companies.test.js +14 -14
- package/test/endpoints/inventory/operation-messages.test.js +10 -10
- package/test/endpoints/inventory/parcel-zones.test.js +12 -13
- package/test/endpoints/inventory/payment-terminals.test.js +7 -7
- package/test/endpoints/inventory/prisma-terminals.test.js +2 -2
- package/test/endpoints/inventory/products.test.js +25 -20
- package/test/endpoints/inventory/promos.test.js +50 -50
- package/test/endpoints/inventory/seatclasses.test.js +2 -2
- package/test/endpoints/inventory/seatfees.test.js +6 -6
- package/test/endpoints/inventory/seatmaps.test.js +7 -7
- package/test/endpoints/inventory/segments-information.test.js +2 -2
- package/test/endpoints/inventory/service-numbers.test.js +6 -6
- package/test/endpoints/inventory/service-types.test.js +7 -7
- package/test/endpoints/inventory/shift-settings.test.js +2 -2
- package/test/endpoints/inventory/ssrs.test.js +10 -11
- package/test/endpoints/inventory/stations-zones.test.js +8 -9
- package/test/endpoints/inventory/stations.test.js +2 -2
- package/test/endpoints/inventory/travel-routes.test.js +2 -2
- package/test/endpoints/inventory/traveller-car-types.test.js +8 -8
- package/test/endpoints/inventory/traveller-card-providers-types.test.js +2 -2
- package/test/endpoints/inventory/traveller-card-providers.test.js +7 -7
- package/test/endpoints/inventory/vehicles.test.js +2 -2
- package/test/endpoints/inventory/zone-price-overages.test.js +2 -2
- package/test/endpoints/inventory/zone-prices.test.js +2 -2
- package/test/endpoints/invoices/dlink.test.js +2 -2
- package/test/endpoints/invoices/gti.test.js +2 -2
- package/test/endpoints/invoices/infile.test.js +2 -2
- package/test/endpoints/invoices/infileJson.test.js +2 -2
- package/test/endpoints/invoices/providers.test.js +4 -4
- package/test/endpoints/invoices/providersSequences.test.js +2 -2
- package/test/endpoints/invoices/system.test.js +2 -2
- package/test/endpoints/loyalty/movements.test.js +11 -11
- package/test/endpoints/loyalty/programs.test.js +21 -21
- package/test/endpoints/notifications/customers.test.js +6 -6
- package/test/endpoints/notifications/external-customers.test.js +10 -10
- package/test/endpoints/notifications/manifet-notifications.test.js +3 -3
- package/test/endpoints/notifications/notify.test.js +5 -5
- package/test/endpoints/notifications/orders-rules-validations.test.js +5 -6
- package/test/endpoints/notifications/pdfs.test.js +4 -4
- package/test/endpoints/notifications/printed-tickets.test.js +17 -18
- package/test/endpoints/notifications/short-urls.test.js +9 -9
- package/test/endpoints/operations/applied_insurance.test.js +10 -14
- package/test/endpoints/operations/calendar_entries.test.js +8 -9
- package/test/endpoints/operations/cancellation_settings.test.js +2 -2
- package/test/endpoints/operations/loans.test.js +2 -2
- package/test/endpoints/operations/manifest.test.js +11 -9
- package/test/endpoints/operations/operations.test.js +42 -25
- package/test/endpoints/operations/parcel_manifests.test.js +3 -3
- package/test/endpoints/operations/parcels.test.js +27 -22
- package/test/endpoints/operations/passenger_check_in_info.test.js +2 -2
- package/test/endpoints/operations/redemption.test.js +2 -2
- package/test/endpoints/operations/sold-items-fulfillment.test.js +2 -2
- package/test/endpoints/operations/sold_items.test.js +3 -3
- package/test/endpoints/operations/tickets.test.js +4 -4
- package/test/endpoints/operations/transaction.test.js +12 -15
- package/test/endpoints/operations/transactions.test.js +11 -11
- package/test/endpoints/operations/transport_regulations.js +2 -4
- package/test/endpoints/operations/trip_change_info.test.js +9 -10
- package/test/endpoints/operations/vehicle-assignments.test.js +5 -7
- package/test/endpoints/operations/waitlists.test.js +3 -3
- package/test/endpoints/ratality/auth.test.js +5 -5
- package/test/endpoints/ratality/client.test.js +4 -4
- package/test/endpoints/ratality/integrations.test.js +15 -9
- package/test/endpoints/reports/custom-reports.test.js +12 -12
- package/test/endpoints/reports/email.test.js +3 -3
- package/test/endpoints/reports/report-types.test.js +6 -6
- package/test/endpoints/reports/trip-manifests.test.js +5 -6
- package/test/endpoints/sales/bundles.test.js +9 -10
- package/test/endpoints/sales/cart-promo.test.js +15 -16
- package/test/endpoints/sales/cart.test.js +7 -7
- package/test/endpoints/sales/check-in-info.test.js +3 -3
- package/test/endpoints/sales/custom-fields.test.js +10 -13
- package/test/endpoints/sales/flexpasses.test.js +2 -2
- package/test/endpoints/sales/git-certificates.test.js +10 -13
- package/test/endpoints/sales/order.test.js +19 -21
- package/test/endpoints/sales/payment-providers.test.js +14 -15
- package/test/endpoints/sales/redeemable-items.test.js +14 -15
- package/test/endpoints/sales/sync-entry.test.js +9 -11
- package/test/endpoints/sales/voucher.test.js +19 -17
- package/test/endpoints/seatmaps/access-ticket.test.js +6 -6
- package/test/endpoints/seatmaps/seat.test.js +6 -6
- package/test/endpoints/uploads/files.test.js +8 -7
- package/test/endpoints/uploads/images.test.js +8 -7
- package/test/endpoints/webhooks/subscriptions.test.js +27 -27
- package/test/endpoints/webhooks/undelivered.test.js +22 -22
- package/test/endpoints/webhooks/webhooks.test.js +7 -7
- package/test/node-test-globals.js +19 -0
- package/test/test-helpers.js +4 -4
- package/test-integration/all.test.js +63 -0
- package/test-integration/endpoints/accounts/current-shifts.test.js +4 -4
- package/test-integration/endpoints/accounts/docs.test.js +6 -6
- package/test-integration/endpoints/accounts/lexicons.test.js +42 -37
- package/test-integration/endpoints/accounts/shifts.test.js +5 -8
- package/test-integration/endpoints/accounts/users.test.js +4 -4
- package/test-integration/endpoints/btrzpay/customerCards.test.js +24 -48
- package/test-integration/endpoints/btrzpay/customers.test.js +20 -34
- package/test-integration/endpoints/btrzpay/payment-methods.test.js +34 -34
- package/test-integration/endpoints/btrzpay/payments.test.js +21 -21
- package/test-integration/endpoints/btrzpay/reference-numbers.test.js +15 -15
- package/test-integration/endpoints/btrzpay/referenced-payments.test.js +5 -5
- package/test-integration/endpoints/client.test.js +6 -10
- package/test-integration/endpoints/inventory/amenities.test.js +34 -34
- package/test-integration/endpoints/inventory/amenity-groups.test.js +30 -31
- package/test-integration/endpoints/inventory/bundle-fares.test.js +10 -12
- package/test-integration/endpoints/inventory/companies.test.js +7 -8
- package/test-integration/endpoints/inventory/countries.test.js +10 -12
- package/test-integration/endpoints/inventory/custom-fields.test.js +2 -2
- package/test-integration/endpoints/inventory/docs.test.js +5 -7
- package/test-integration/endpoints/inventory/fare-classes.test.js +12 -13
- package/test-integration/endpoints/inventory/fares.test.js +7 -9
- package/test-integration/endpoints/inventory/fees.test.js +8 -10
- package/test-integration/endpoints/inventory/filtered-trips.test.js +15 -12
- package/test-integration/endpoints/inventory/gift-certificate-definitions.test.js +5 -5
- package/test-integration/endpoints/inventory/insurances.test.js +36 -34
- package/test-integration/endpoints/inventory/items.js +10 -12
- package/test-integration/endpoints/inventory/journey-prices.test.js +11 -11
- package/test-integration/endpoints/inventory/parcel-zones.test.js +15 -18
- package/test-integration/endpoints/inventory/products.test.js +12 -14
- package/test-integration/endpoints/inventory/promos.test.js +46 -42
- package/test-integration/endpoints/inventory/routes.test.js +13 -15
- package/test-integration/endpoints/inventory/schedule-groups.test.js +23 -23
- package/test-integration/endpoints/inventory/ssrs.test.js +16 -11
- package/test-integration/endpoints/inventory/stations-zones.test.js +5 -6
- package/test-integration/endpoints/inventory/stations.test.js +17 -20
- package/test-integration/endpoints/inventory/trips.test.js +30 -16
- package/test-integration/endpoints/notifications/printed-tickets.test.js +2 -2
- package/test-integration/endpoints/operations/applied_insurance.test.js +9 -11
- package/test-integration/endpoints/operations/manifest.test.js +32 -34
- package/test-integration/endpoints/operations/parcel.test.js +36 -38
- package/test-integration/endpoints/operations/redemption.test.js +9 -12
- package/test-integration/endpoints/operations/segments.js +8 -10
- package/test-integration/endpoints/operations/tickets.test.js +11 -11
- package/test-integration/endpoints/operations/transaction.test.js +1 -1
- package/test-integration/endpoints/operations/transactions.test.js +2 -2
- package/test-integration/endpoints/operations/trip_change_info.test.js +11 -13
- package/test-integration/endpoints/reports/custom-reports.test.js +21 -21
- package/test-integration/endpoints/reports/report-types.test.js +22 -22
- package/test-integration/endpoints/sales/bundles.test.js +5 -5
- package/test-integration/endpoints/sales/cart-promo.test.js +17 -32
- package/test-integration/endpoints/sales/cart.test.js +45 -51
- package/test-integration/endpoints/sales/check-in-info.test.js +2 -2
- package/test-integration/endpoints/sales/custom-fields.test.js +8 -10
- package/test-integration/endpoints/sales/flexpasses.test.js +2 -2
- package/test-integration/endpoints/sales/gift-certificates.test.js +14 -18
- package/test-integration/endpoints/sales/order.test.js +42 -50
- package/test-integration/endpoints/sales/payment-providers.test.js +7 -9
- package/test-integration/endpoints/sales/redeemable-items.test.js +17 -19
- package/test-integration/endpoints/sales/voucher.test.js +12 -14
- package/test-integration/endpoints/seatmaps/access-ticket.test.js +7 -9
- package/test-integration/endpoints/seatmaps/seat.test.js +7 -9
- package/test-integration/endpoints/uploads/files.test.js +14 -14
- package/test-integration/endpoints/uploads/images.test.js +3 -5
- package/test-integration/ports.js +4 -4
- package/test-integration/test-integration-helpers.js +13 -9
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
const {
|
|
2
|
-
const api = require("../../../src/client").createApiClient({
|
|
1
|
+
const {axiosMock, expectRequest} = require("../../test-helpers.js");
|
|
2
|
+
const api = require("../../../src/client.js").createApiClient({baseURL: "http://test.com"});
|
|
3
3
|
|
|
4
|
-
describe(
|
|
5
|
-
const token =
|
|
6
|
-
|
|
4
|
+
describe("inventory/operation-messages", () => {
|
|
5
|
+
const token = "I owe you a token";
|
|
6
|
+
const jwtToken = "I owe you a JWT token";
|
|
7
7
|
|
|
8
8
|
afterEach(() => {
|
|
9
9
|
axiosMock.reset();
|
|
10
10
|
});
|
|
11
11
|
|
|
12
12
|
it("should define a create method for an operation message", () => {
|
|
13
|
-
axiosMock.onPost(
|
|
13
|
+
axiosMock.onPost("/operation-messages").reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
14
14
|
return api.inventory.operationMessages.create({
|
|
15
15
|
jwtToken,
|
|
16
16
|
token,
|
|
@@ -23,7 +23,7 @@ describe('inventory/operation-messages', () => {
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
it("should define a get method for listing all operation messages", () => {
|
|
26
|
-
axiosMock.onGet(
|
|
26
|
+
axiosMock.onGet("/operation-messages").reply(expectRequest({statusCode: 200, token}));
|
|
27
27
|
return api.inventory.operationMessages.all({
|
|
28
28
|
token
|
|
29
29
|
});
|
|
@@ -31,7 +31,7 @@ describe('inventory/operation-messages', () => {
|
|
|
31
31
|
|
|
32
32
|
it("should define an update method for an operation message", () => {
|
|
33
33
|
const operationMessageId = "1234";
|
|
34
|
-
axiosMock.onPut(`/operation-messages/${operationMessageId}`).reply(expectRequest({
|
|
34
|
+
axiosMock.onPut(`/operation-messages/${operationMessageId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
35
35
|
return api.inventory.operationMessages.update({
|
|
36
36
|
jwtToken,
|
|
37
37
|
token,
|
|
@@ -45,7 +45,7 @@ describe('inventory/operation-messages', () => {
|
|
|
45
45
|
|
|
46
46
|
it("should define a deletion method for an operation message", () => {
|
|
47
47
|
const operationMessageId = "1234";
|
|
48
|
-
axiosMock.onDelete(`/operation-messages/${operationMessageId}`).reply(expectRequest({
|
|
48
|
+
axiosMock.onDelete(`/operation-messages/${operationMessageId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
49
49
|
return api.inventory.operationMessages.remove({
|
|
50
50
|
jwtToken,
|
|
51
51
|
token,
|
|
@@ -55,7 +55,7 @@ describe('inventory/operation-messages', () => {
|
|
|
55
55
|
|
|
56
56
|
it("should define a get method for an operation message", () => {
|
|
57
57
|
const operationMessageId = "1234";
|
|
58
|
-
axiosMock.onGet(`/operation-messages/${operationMessageId}`).reply(expectRequest({
|
|
58
|
+
axiosMock.onGet(`/operation-messages/${operationMessageId}`).reply(expectRequest({statusCode: 200, token}));
|
|
59
59
|
return api.inventory.operationMessages.get({
|
|
60
60
|
token,
|
|
61
61
|
operationMessageId
|
|
@@ -1,28 +1,27 @@
|
|
|
1
|
-
const {
|
|
2
|
-
const api = require("./../../../src/client").createApiClient({
|
|
1
|
+
const {axiosMock, expectRequest} = require("./../../test-helpers.js");
|
|
2
|
+
const api = require("./../../../src/client.js").createApiClient({baseURL: "http://test.com"});
|
|
3
3
|
|
|
4
|
-
describe(
|
|
5
|
-
const token =
|
|
6
|
-
|
|
4
|
+
describe("inventory/parcel-zones", () => {
|
|
5
|
+
const token = "I owe you a token";
|
|
6
|
+
const jwtToken = "I owe you a JWT token";
|
|
7
7
|
|
|
8
8
|
afterEach(() => {
|
|
9
9
|
axiosMock.reset();
|
|
10
10
|
});
|
|
11
11
|
|
|
12
12
|
it("should list parcel zones", () => {
|
|
13
|
-
axiosMock.onGet(
|
|
14
|
-
return api.inventory.parcelZones.all({
|
|
13
|
+
axiosMock.onGet("/parcel-zones").reply(expectRequest({statusCode: 200, token}));
|
|
14
|
+
return api.inventory.parcelZones.all({token});
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
it("should create parcel zones", () => {
|
|
18
|
-
axiosMock.onPost(
|
|
19
|
-
return api.inventory.parcelZones.create({
|
|
18
|
+
axiosMock.onPost("/parcel-zones").reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
19
|
+
return api.inventory.parcelZones.create({jwtToken, token, parcelZone: {productId: "6789"}});
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
it("should update a parcel zone", () => {
|
|
23
23
|
const parcelZoneId = "1234";
|
|
24
|
-
axiosMock.onPut(`/parcel-zone/${parcelZoneId}`).reply(expectRequest({
|
|
25
|
-
return api.inventory.parcelZones.update({
|
|
24
|
+
axiosMock.onPut(`/parcel-zone/${parcelZoneId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
25
|
+
return api.inventory.parcelZones.update({jwtToken, token, parcelZoneId, parcelZone: {productId: "6789"}});
|
|
26
26
|
});
|
|
27
|
-
|
|
28
|
-
});
|
|
27
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const {
|
|
2
2
|
axiosMock, expectRequest
|
|
3
|
-
} = require("./../../test-helpers");
|
|
4
|
-
const api = require("./../../../src/client").createApiClient({baseURL: "http://test.com"});
|
|
3
|
+
} = require("./../../test-helpers.js");
|
|
4
|
+
const api = require("./../../../src/client.js").createApiClient({baseURL: "http://test.com"});
|
|
5
5
|
|
|
6
6
|
describe("inventory/payment-terminals", () => {
|
|
7
7
|
const token = "I owe you a token";
|
|
@@ -12,7 +12,7 @@ describe("inventory/payment-terminals", () => {
|
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
it("should create a payment terminal", () => {
|
|
15
|
-
axiosMock.onPost("/payment-terminals").reply(expectRequest({
|
|
15
|
+
axiosMock.onPost("/payment-terminals").reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
16
16
|
return api.inventory.paymentTerminals.create({
|
|
17
17
|
jwtToken,
|
|
18
18
|
token,
|
|
@@ -23,7 +23,7 @@ describe("inventory/payment-terminals", () => {
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
it("should get all payment terminals", () => {
|
|
26
|
-
axiosMock.onGet("/payment-terminals").reply(expectRequest({statusCode: 200, token, jwtToken
|
|
26
|
+
axiosMock.onGet("/payment-terminals").reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
27
27
|
return api.inventory.paymentTerminals.all({
|
|
28
28
|
jwtToken,
|
|
29
29
|
token,
|
|
@@ -33,7 +33,7 @@ describe("inventory/payment-terminals", () => {
|
|
|
33
33
|
|
|
34
34
|
it("should update a payment terminal", () => {
|
|
35
35
|
const paymentTerminalId = "1234";
|
|
36
|
-
axiosMock.onPut(`/payment-terminals/${paymentTerminalId}`).reply(expectRequest({
|
|
36
|
+
axiosMock.onPut(`/payment-terminals/${paymentTerminalId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
37
37
|
return api.inventory.paymentTerminals.update({
|
|
38
38
|
jwtToken,
|
|
39
39
|
token,
|
|
@@ -46,7 +46,7 @@ describe("inventory/payment-terminals", () => {
|
|
|
46
46
|
|
|
47
47
|
it("should get a payment terminal", () => {
|
|
48
48
|
const paymentTerminalId = "1234";
|
|
49
|
-
axiosMock.onGet(`/payment-terminals/${paymentTerminalId}`).reply(expectRequest({
|
|
49
|
+
axiosMock.onGet(`/payment-terminals/${paymentTerminalId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
50
50
|
return api.inventory.paymentTerminals.get({
|
|
51
51
|
jwtToken,
|
|
52
52
|
token,
|
|
@@ -56,7 +56,7 @@ describe("inventory/payment-terminals", () => {
|
|
|
56
56
|
|
|
57
57
|
it("should delete a payment terminal", () => {
|
|
58
58
|
const paymentTerminalId = "1234";
|
|
59
|
-
axiosMock.onDelete(`/payment-terminals/${paymentTerminalId}`).reply(expectRequest({
|
|
59
|
+
axiosMock.onDelete(`/payment-terminals/${paymentTerminalId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
60
60
|
return api.inventory.paymentTerminals.remove({
|
|
61
61
|
jwtToken,
|
|
62
62
|
token,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const {
|
|
2
2
|
axiosMock, expectRequest
|
|
3
|
-
} = require("../../test-helpers");
|
|
4
|
-
const api = require("../../../src/client").createApiClient({baseURL: "http://test.com"});
|
|
3
|
+
} = require("../../test-helpers.js");
|
|
4
|
+
const api = require("../../../src/client.js").createApiClient({baseURL: "http://test.com"});
|
|
5
5
|
|
|
6
6
|
describe("inventory/prisma-terminals", () => {
|
|
7
7
|
const token = "I owe you a token";
|
|
@@ -1,41 +1,47 @@
|
|
|
1
|
-
const {
|
|
2
|
-
const api = require("./../../../src/client").createApiClient({
|
|
1
|
+
const {axiosMock, expectRequest} = require("./../../test-helpers.js");
|
|
2
|
+
const api = require("./../../../src/client.js").createApiClient({baseURL: "http://test.com"});
|
|
3
3
|
|
|
4
|
-
describe(
|
|
5
|
-
const token =
|
|
6
|
-
const jwtToken =
|
|
4
|
+
describe("inventory/products", () => {
|
|
5
|
+
const token = "I owe you a token";
|
|
6
|
+
const jwtToken = "I owe you a JWT token";
|
|
7
7
|
|
|
8
|
-
afterEach(
|
|
8
|
+
afterEach(() => {
|
|
9
9
|
axiosMock.reset();
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
it("should list products",
|
|
13
|
-
axiosMock.onGet(
|
|
14
|
-
return api.inventory.products.all({
|
|
12
|
+
it("should list products", () => {
|
|
13
|
+
axiosMock.onGet("/products").reply(expectRequest({statusCode: 200, token}));
|
|
14
|
+
return api.inventory.products.all({token});
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
-
it("should
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
it("should list products with type query", () => {
|
|
18
|
+
const query = {type: "ticket"};
|
|
19
|
+
axiosMock.onGet("/products").reply(expectRequest({statusCode: 200, token, query}));
|
|
20
|
+
return api.inventory.products.all({token, query});
|
|
20
21
|
});
|
|
21
22
|
|
|
22
|
-
it("should get product by id
|
|
23
|
-
axiosMock.onGet(
|
|
24
|
-
return api.inventory.products.get({
|
|
23
|
+
it("should get product by id without jwtToken", () => {
|
|
24
|
+
axiosMock.onGet("/products/1").reply(expectRequest({statusCode: 200, token}));
|
|
25
|
+
return api.inventory.products.get({token, productId: 1});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("should get product by id when called with jwtToken", () => {
|
|
29
|
+
axiosMock.onGet("/products/1").reply(expectRequest({statusCode: 200, token, jwtToken, requireJwtTokenOnGet: true}));
|
|
30
|
+
return api.inventory.products.get({token, productId: 1, jwtToken});
|
|
25
31
|
});
|
|
26
32
|
|
|
27
33
|
it("should get the product families", () => {
|
|
28
|
-
axiosMock.onGet(
|
|
29
|
-
return api.inventory.products.families.all({
|
|
34
|
+
axiosMock.onGet("/products/families").reply(expectRequest({statusCode: 200, token}));
|
|
35
|
+
return api.inventory.products.families.all({token});
|
|
30
36
|
});
|
|
31
37
|
|
|
32
|
-
it("should create a product",
|
|
38
|
+
it("should create a product", () => {
|
|
33
39
|
const data = {name: "Test Product"};
|
|
34
40
|
axiosMock.onPost("/products").reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
35
41
|
return api.inventory.products.create({token, jwtToken, data});
|
|
36
42
|
});
|
|
37
43
|
|
|
38
|
-
it("should update a product",
|
|
44
|
+
it("should update a product", () => {
|
|
39
45
|
const data = {name: "Test Product"};
|
|
40
46
|
const productId = 1;
|
|
41
47
|
axiosMock.onPut(`/products/${productId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
@@ -56,5 +62,4 @@ describe('inventory/products', function() {
|
|
|
56
62
|
domain
|
|
57
63
|
});
|
|
58
64
|
});
|
|
59
|
-
|
|
60
65
|
});
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
const {
|
|
2
|
-
const api = require("./../../../src/client").createApiClient({
|
|
1
|
+
const {axiosMock, expectRequest} = require("./../../test-helpers.js");
|
|
2
|
+
const api = require("./../../../src/client.js").createApiClient({baseURL: "http://test.com"});
|
|
3
3
|
|
|
4
|
-
describe(
|
|
5
|
-
const token =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
4
|
+
describe("inventory/promos", () => {
|
|
5
|
+
const token = "I owe you a token";
|
|
6
|
+
const promoId = "5a959a4aa7114ffd7f000001";
|
|
7
|
+
const accountId = "4f74a235b0dffc0210000015";
|
|
8
|
+
const ruleId = "";
|
|
9
|
+
const jwtToken = "I owe you a JWT token";
|
|
10
|
+
const promo = {
|
|
11
|
+
"accountId": "4f74a235b0dffc0210000015",
|
|
12
|
+
"internalId": "patchTEST",
|
|
13
|
+
"name": "patchTEST"
|
|
14
|
+
};
|
|
15
|
+
const updatePromoData = {
|
|
16
|
+
"internalId": "createTESTmod",
|
|
17
|
+
"campaign": "patchTEST",
|
|
18
|
+
"name": "patchTESTmod",
|
|
19
|
+
"disabled": false
|
|
20
|
+
};
|
|
21
|
+
const rule = {
|
|
22
|
+
"valueType": "%",
|
|
23
|
+
"value": 100
|
|
24
|
+
};
|
|
25
25
|
|
|
26
|
-
afterEach(
|
|
26
|
+
afterEach(() => {
|
|
27
27
|
axiosMock.reset();
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
-
it("should list promos",
|
|
31
|
-
axiosMock.onGet(
|
|
32
|
-
return api.inventory.promos.all({
|
|
30
|
+
it("should list promos", () => {
|
|
31
|
+
axiosMock.onGet("/promos").reply(expectRequest({statusCode: 200, token}));
|
|
32
|
+
return api.inventory.promos.all({token});
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
it("should send jwt token when listing promos",
|
|
36
|
-
axiosMock.onGet(
|
|
35
|
+
it("should send jwt token when listing promos", () => {
|
|
36
|
+
axiosMock.onGet("/promos").reply(expectRequest({
|
|
37
37
|
statusCode: 200,
|
|
38
38
|
token,
|
|
39
39
|
jwtToken,
|
|
40
40
|
requireJwtTokenOnGet: true
|
|
41
41
|
}));
|
|
42
|
-
return api.inventory.promos.all({
|
|
42
|
+
return api.inventory.promos.all({token, jwtToken});
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
it("should get single promo",
|
|
46
|
-
axiosMock.onGet(`/promos/${promoId}`).reply(expectRequest({
|
|
45
|
+
it("should get single promo", () => {
|
|
46
|
+
axiosMock.onGet(`/promos/${promoId}`).reply(expectRequest({statusCode: 200, token}));
|
|
47
47
|
const query = {accountId};
|
|
48
|
-
return api.inventory.promos.get({
|
|
48
|
+
return api.inventory.promos.get({promoId, accountId, token, query});
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
it("should send jwt token when getting a promo by id",
|
|
51
|
+
it("should send jwt token when getting a promo by id", () => {
|
|
52
52
|
axiosMock.onGet(`/promos/${promoId}`).reply(expectRequest({
|
|
53
53
|
statusCode: 200,
|
|
54
54
|
token,
|
|
@@ -56,31 +56,31 @@ describe('inventory/promos', function() {
|
|
|
56
56
|
requireJwtTokenOnGet: true
|
|
57
57
|
}));
|
|
58
58
|
const query = {accountId};
|
|
59
|
-
return api.inventory.promos.get({
|
|
59
|
+
return api.inventory.promos.get({promoId, accountId, token, jwtToken, query});
|
|
60
60
|
});
|
|
61
61
|
|
|
62
|
-
it("should create new promo",
|
|
63
|
-
axiosMock.onPost(
|
|
64
|
-
return api.inventory.promos.create({
|
|
62
|
+
it("should create new promo", () => {
|
|
63
|
+
axiosMock.onPost("/promos").reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
64
|
+
return api.inventory.promos.create({jwtToken, promo, token});
|
|
65
65
|
});
|
|
66
66
|
|
|
67
|
-
it("should remove promo with given id",
|
|
68
|
-
axiosMock.onDelete(`/promos/${promoId}`).reply(expectRequest({
|
|
69
|
-
return api.inventory.promos.remove({
|
|
67
|
+
it("should remove promo with given id", () => {
|
|
68
|
+
axiosMock.onDelete(`/promos/${promoId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
69
|
+
return api.inventory.promos.remove({jwtToken, promoId, token});
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
it("should update existing promo",
|
|
73
|
-
axiosMock.onPatch(`/promos/${promoId}`).reply(expectRequest({
|
|
74
|
-
return api.inventory.promos.update({
|
|
72
|
+
it("should update existing promo", () => {
|
|
73
|
+
axiosMock.onPatch(`/promos/${promoId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
74
|
+
return api.inventory.promos.update({token, jwtToken, promoId, updatePromoData});
|
|
75
75
|
});
|
|
76
76
|
|
|
77
|
-
it("should add rule to a promo",
|
|
78
|
-
axiosMock.onPost(`/promos/${promoId}/rules`).reply(expectRequest({
|
|
79
|
-
return api.inventory.promos.addRule({
|
|
77
|
+
it("should add rule to a promo", () => {
|
|
78
|
+
axiosMock.onPost(`/promos/${promoId}/rules`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
79
|
+
return api.inventory.promos.addRule({token, jwtToken, promoId, updatePromoData});
|
|
80
80
|
});
|
|
81
81
|
|
|
82
|
-
it("should update a rule",
|
|
83
|
-
axiosMock.onPut(`/promos/${promoId}/rules/${ruleId}`).reply(expectRequest({
|
|
84
|
-
return api.inventory.promos.updateRule({
|
|
82
|
+
it("should update a rule", () => {
|
|
83
|
+
axiosMock.onPut(`/promos/${promoId}/rules/${ruleId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
84
|
+
return api.inventory.promos.updateRule({token, jwtToken, promoId, ruleId, rule});
|
|
85
85
|
});
|
|
86
86
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable import/extensions */
|
|
2
|
-
const {axiosMock, expectRequest} = require("./../../test-helpers");
|
|
3
|
-
const api = require("./../../../src/client").createApiClient({baseURL: "http://test.com"});
|
|
2
|
+
const {axiosMock, expectRequest} = require("./../../test-helpers.js");
|
|
3
|
+
const api = require("./../../../src/client.js").createApiClient({baseURL: "http://test.com"});
|
|
4
4
|
|
|
5
5
|
describe("inventory/seatclasses", () => {
|
|
6
6
|
const token = "I owe you a token";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const {
|
|
2
2
|
axiosMock, expectRequest
|
|
3
|
-
} = require("./../../test-helpers");
|
|
4
|
-
const api = require("./../../../src/client").createApiClient({baseURL: "http://test.com"});
|
|
3
|
+
} = require("./../../test-helpers.js");
|
|
4
|
+
const api = require("./../../../src/client.js").createApiClient({baseURL: "http://test.com"});
|
|
5
5
|
|
|
6
6
|
describe("inventory/seat-fees", () => {
|
|
7
7
|
const token = "I owe you a token";
|
|
@@ -12,7 +12,7 @@ describe("inventory/seat-fees", () => {
|
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
it("should create a seatfee", () => {
|
|
15
|
-
axiosMock.onPost("/seat-fees").reply(expectRequest({
|
|
15
|
+
axiosMock.onPost("/seat-fees").reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
16
16
|
return api.inventory.seatfees.create({
|
|
17
17
|
jwtToken,
|
|
18
18
|
token,
|
|
@@ -23,7 +23,7 @@ describe("inventory/seat-fees", () => {
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
it("should get all the seatfees", () => {
|
|
26
|
-
axiosMock.onGet("/seat-fees").reply(expectRequest({statusCode: 200, token, jwtToken
|
|
26
|
+
axiosMock.onGet("/seat-fees").reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
27
27
|
return api.inventory.seatfees.all({
|
|
28
28
|
jwtToken,
|
|
29
29
|
token,
|
|
@@ -33,7 +33,7 @@ describe("inventory/seat-fees", () => {
|
|
|
33
33
|
|
|
34
34
|
it("should update a seatfee", () => {
|
|
35
35
|
const seatfeeId = "1234";
|
|
36
|
-
axiosMock.onPut(`/seat-fees/${seatfeeId}`).reply(expectRequest({
|
|
36
|
+
axiosMock.onPut(`/seat-fees/${seatfeeId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
37
37
|
return api.inventory.seatfees.update({
|
|
38
38
|
jwtToken,
|
|
39
39
|
token,
|
|
@@ -46,7 +46,7 @@ describe("inventory/seat-fees", () => {
|
|
|
46
46
|
|
|
47
47
|
it("should get a seatfee", () => {
|
|
48
48
|
const seatfeeId = "1234";
|
|
49
|
-
axiosMock.onGet(`/seat-fees/${seatfeeId}`).reply(expectRequest({
|
|
49
|
+
axiosMock.onGet(`/seat-fees/${seatfeeId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
50
50
|
return api.inventory.seatfees.get({
|
|
51
51
|
jwtToken,
|
|
52
52
|
token,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const {axiosMock, expectRequest} = require("./../../test-helpers");
|
|
2
|
-
const
|
|
3
|
-
const api = require("./../../../src/client").createApiClient({baseURL: "http://test.com"});
|
|
1
|
+
const {axiosMock, expectRequest} = require("./../../test-helpers.js");
|
|
2
|
+
const assert = require("node:assert/strict");
|
|
3
|
+
const api = require("./../../../src/client.js").createApiClient({baseURL: "http://test.com"});
|
|
4
4
|
|
|
5
5
|
describe("inventory/seatmaps", () => {
|
|
6
6
|
const token = "I owe you a token";
|
|
@@ -41,16 +41,16 @@ describe("inventory/seatmaps", () => {
|
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
axiosMock.onGet(`/seatmaps/${seatmapId}/available-seats/${routeId}/${scheduleId}/${manifestDate}`).reply((config) => {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
assert.deepStrictEqual(config.params, query);
|
|
45
|
+
assert.deepStrictEqual(config.headers["x-api-key"], token);
|
|
46
46
|
return [200, response];
|
|
47
47
|
});
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
return api.inventory.seatmaps.get({seatmapId, routeId, scheduleId, manifestDate, query, token})
|
|
51
51
|
.then((httpResponse) => {
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
assert.deepStrictEqual(httpResponse.status, 200);
|
|
53
|
+
assert.deepStrictEqual(httpResponse.data, response);
|
|
54
54
|
});
|
|
55
55
|
});
|
|
56
56
|
|
|
@@ -23,7 +23,7 @@ describe("inventory/segments-information", () => {
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
it("should get all pieces of segment information", () => {
|
|
26
|
-
axiosMock.onGet("/segments-information").reply(expectRequest({statusCode: 200, token, jwtToken
|
|
26
|
+
axiosMock.onGet("/segments-information").reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
27
27
|
return api.inventory.segmentsInformation.all({
|
|
28
28
|
jwtToken,
|
|
29
29
|
token,
|
|
@@ -33,7 +33,7 @@ describe("inventory/segments-information", () => {
|
|
|
33
33
|
|
|
34
34
|
it("should update a piece of segment information", () => {
|
|
35
35
|
const segmentInformationId = "1234";
|
|
36
|
-
axiosMock.onPut(`/segments-information/${segmentInformationId}`).reply(expectRequest({
|
|
36
|
+
axiosMock.onPut(`/segments-information/${segmentInformationId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
37
37
|
return api.inventory.segmentsInformation.update({
|
|
38
38
|
jwtToken,
|
|
39
39
|
token,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const {
|
|
2
2
|
axiosMock, expectRequest
|
|
3
|
-
} = require("./../../test-helpers");
|
|
4
|
-
const api = require("./../../../src/client").createApiClient({baseURL: "http://test.com"});
|
|
3
|
+
} = require("./../../test-helpers.js");
|
|
4
|
+
const api = require("./../../../src/client.js").createApiClient({baseURL: "http://test.com"});
|
|
5
5
|
|
|
6
6
|
describe("inventory/service-numbers", () => {
|
|
7
7
|
const token = "I owe you a token";
|
|
@@ -12,7 +12,7 @@ describe("inventory/service-numbers", () => {
|
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
it("should create a service number", () => {
|
|
15
|
-
axiosMock.onPost("/service-numbers").reply(expectRequest({
|
|
15
|
+
axiosMock.onPost("/service-numbers").reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
16
16
|
return api.inventory.serviceNumbers.create({
|
|
17
17
|
jwtToken,
|
|
18
18
|
token,
|
|
@@ -24,7 +24,7 @@ describe("inventory/service-numbers", () => {
|
|
|
24
24
|
});
|
|
25
25
|
|
|
26
26
|
it("should get all service numbers", () => {
|
|
27
|
-
axiosMock.onGet("/service-numbers").reply(expectRequest({statusCode: 200, token, jwtToken
|
|
27
|
+
axiosMock.onGet("/service-numbers").reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
28
28
|
return api.inventory.serviceNumbers.all({
|
|
29
29
|
jwtToken,
|
|
30
30
|
token,
|
|
@@ -36,7 +36,7 @@ describe("inventory/service-numbers", () => {
|
|
|
36
36
|
|
|
37
37
|
it("should update a service number", () => {
|
|
38
38
|
const serviceNumberId = "1234";
|
|
39
|
-
axiosMock.onPut(`/service-numbers/${serviceNumberId}`).reply(expectRequest({
|
|
39
|
+
axiosMock.onPut(`/service-numbers/${serviceNumberId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
40
40
|
return api.inventory.serviceNumbers.update({
|
|
41
41
|
jwtToken,
|
|
42
42
|
token,
|
|
@@ -50,7 +50,7 @@ describe("inventory/service-numbers", () => {
|
|
|
50
50
|
|
|
51
51
|
it("should get a service number", () => {
|
|
52
52
|
const serviceNumberId = "1234";
|
|
53
|
-
axiosMock.onGet(`/service-numbers/${serviceNumberId}`).reply(expectRequest({
|
|
53
|
+
axiosMock.onGet(`/service-numbers/${serviceNumberId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
54
54
|
return api.inventory.serviceNumbers.get({
|
|
55
55
|
jwtToken,
|
|
56
56
|
token,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const {
|
|
2
2
|
axiosMock, expectRequest
|
|
3
|
-
} = require("./../../test-helpers");
|
|
4
|
-
const api = require("./../../../src/client").createApiClient({baseURL: "http://test.com"});
|
|
3
|
+
} = require("./../../test-helpers.js");
|
|
4
|
+
const api = require("./../../../src/client.js").createApiClient({baseURL: "http://test.com"});
|
|
5
5
|
|
|
6
6
|
describe("inventory/service-types", () => {
|
|
7
7
|
const token = "I owe you a token";
|
|
@@ -12,7 +12,7 @@ describe("inventory/service-types", () => {
|
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
it("should create a service type", () => {
|
|
15
|
-
axiosMock.onPost("/service-types").reply(expectRequest({
|
|
15
|
+
axiosMock.onPost("/service-types").reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
16
16
|
return api.inventory.serviceTypes.create({
|
|
17
17
|
jwtToken,
|
|
18
18
|
token,
|
|
@@ -23,7 +23,7 @@ describe("inventory/service-types", () => {
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
it("should get all service types", () => {
|
|
26
|
-
axiosMock.onGet("/service-types").reply(expectRequest({statusCode: 200, token, jwtToken
|
|
26
|
+
axiosMock.onGet("/service-types").reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
27
27
|
return api.inventory.serviceTypes.all({
|
|
28
28
|
jwtToken,
|
|
29
29
|
token,
|
|
@@ -33,7 +33,7 @@ describe("inventory/service-types", () => {
|
|
|
33
33
|
|
|
34
34
|
it("should update a service type", () => {
|
|
35
35
|
const serviceTypeId = "1234";
|
|
36
|
-
axiosMock.onPut(`/service-types/${serviceTypeId}`).reply(expectRequest({
|
|
36
|
+
axiosMock.onPut(`/service-types/${serviceTypeId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
37
37
|
return api.inventory.serviceTypes.update({
|
|
38
38
|
jwtToken,
|
|
39
39
|
token,
|
|
@@ -46,7 +46,7 @@ describe("inventory/service-types", () => {
|
|
|
46
46
|
|
|
47
47
|
it("should get a service type", () => {
|
|
48
48
|
const serviceTypeId = "1234";
|
|
49
|
-
axiosMock.onGet(`/service-types/${serviceTypeId}`).reply(expectRequest({
|
|
49
|
+
axiosMock.onGet(`/service-types/${serviceTypeId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
50
50
|
return api.inventory.serviceTypes.get({
|
|
51
51
|
jwtToken,
|
|
52
52
|
token,
|
|
@@ -56,7 +56,7 @@ describe("inventory/service-types", () => {
|
|
|
56
56
|
|
|
57
57
|
it("should delete a service type", () => {
|
|
58
58
|
const serviceTypeId = "1234";
|
|
59
|
-
axiosMock.onDelete(`/service-types/${serviceTypeId}`).reply(expectRequest({
|
|
59
|
+
axiosMock.onDelete(`/service-types/${serviceTypeId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
60
60
|
return api.inventory.serviceTypes.remove({
|
|
61
61
|
jwtToken,
|
|
62
62
|
token,
|
|
@@ -23,7 +23,7 @@ describe("accounts/banks", () => {
|
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
it("should get all pieces of custom content", () => {
|
|
26
|
-
axiosMock.onGet("/banks").reply(expectRequest({statusCode: 200, token, jwtToken
|
|
26
|
+
axiosMock.onGet("/banks").reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
27
27
|
return api.inventory.banks.all({
|
|
28
28
|
jwtToken,
|
|
29
29
|
token,
|
|
@@ -33,7 +33,7 @@ describe("accounts/banks", () => {
|
|
|
33
33
|
|
|
34
34
|
it("should update a piece of custom content", () => {
|
|
35
35
|
const bankId = "1234";
|
|
36
|
-
axiosMock.onPut(`/banks/${bankId}`).reply(expectRequest({
|
|
36
|
+
axiosMock.onPut(`/banks/${bankId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
|
|
37
37
|
return api.inventory.banks.update({
|
|
38
38
|
jwtToken,
|
|
39
39
|
token,
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
const {
|
|
2
|
-
const api = require("./../../../src/client").createApiClient({
|
|
1
|
+
const {axiosMock, expectRequest} = require("./../../test-helpers.js");
|
|
2
|
+
const api = require("./../../../src/client.js").createApiClient({baseURL: "http://test.com"});
|
|
3
3
|
|
|
4
|
-
describe(
|
|
5
|
-
const token =
|
|
6
|
-
|
|
7
|
-
afterEach(
|
|
4
|
+
describe("inventory/ssrs", () => {
|
|
5
|
+
const token = "I owe you a token";
|
|
6
|
+
|
|
7
|
+
afterEach(() => {
|
|
8
8
|
axiosMock.reset();
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
it("should list ssrs",
|
|
12
|
-
axiosMock.onGet(
|
|
13
|
-
return api.inventory.ssrs.all({
|
|
11
|
+
it("should list ssrs", () => {
|
|
12
|
+
axiosMock.onGet("/ssrs").reply(expectRequest({statusCode: 200, token}));
|
|
13
|
+
return api.inventory.ssrs.all({token});
|
|
14
14
|
});
|
|
15
|
-
|
|
16
|
-
});
|
|
15
|
+
});
|