btrz-api-client 8.64.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.
Files changed (244) hide show
  1. package/.eslint-report.json +1 -0
  2. package/.eslintignore +2 -0
  3. package/fetch-test.js +5 -6
  4. package/index.js +2 -2
  5. package/lib/client-standalone-min.js +3 -3
  6. package/lib/client.js +50 -38
  7. package/lib/endpoints/accounts/journey-prices-settings.js +2 -2
  8. package/lib/endpoints/accounts/market-pricing-settings.js +3 -3
  9. package/lib/endpoints/accounts/multiproduct-sales-settings.js +6 -2
  10. package/lib/endpoints/accounts/operation-settings.js +3 -1
  11. package/lib/endpoints/btrzpay/referenced-payments.js +6 -2
  12. package/lib/endpoints/btrzpay/square.js +12 -3
  13. package/lib/endpoints/btrzpay/stripe-terminals.js +9 -3
  14. package/lib/endpoints/btrzpay/terminalPayments.js +14 -4
  15. package/lib/endpoints/inventory/document-types.js +2 -1
  16. package/lib/endpoints/inventory/products.js +1 -0
  17. package/lib/endpoints/notifications/pdf-data.js +3 -6
  18. package/lib/endpoints/operations/movements.js +7 -2
  19. package/lib/endpoints/operations/pago-express.js +9 -3
  20. package/lib/endpoints/operations/parcels.js +3 -1
  21. package/lib/endpoints/sales/cancellations.js +31 -8
  22. package/package.json +6 -8
  23. package/src/client.js +0 -1
  24. package/src/endpoints/accounts/journey-prices-settings.js +2 -2
  25. package/src/endpoints/accounts/market-pricing-settings.js +3 -3
  26. package/src/endpoints/accounts/multiproduct-sales-settings.js +6 -2
  27. package/src/endpoints/accounts/operation-settings.js +3 -1
  28. package/src/endpoints/btrzpay/referenced-payments.js +6 -2
  29. package/src/endpoints/btrzpay/square.js +12 -3
  30. package/src/endpoints/btrzpay/stripe-terminals.js +9 -3
  31. package/src/endpoints/btrzpay/terminalPayments.js +14 -4
  32. package/src/endpoints/inventory/document-types.js +2 -1
  33. package/src/endpoints/inventory/products.js +1 -0
  34. package/src/endpoints/notifications/pdf-data.js +3 -6
  35. package/src/endpoints/operations/movements.js +7 -2
  36. package/src/endpoints/operations/pago-express.js +9 -3
  37. package/src/endpoints/operations/parcels.js +3 -1
  38. package/src/endpoints/sales/cancellations.js +31 -8
  39. package/test/all.test.js +218 -0
  40. package/test/client.test.js +58 -44
  41. package/test/endpoints/accounts/application-settings.test.js +2 -2
  42. package/test/endpoints/accounts/applications.test.js +2 -2
  43. package/test/endpoints/accounts/current-shifts.test.js +2 -2
  44. package/test/endpoints/accounts/customers.js +17 -17
  45. package/test/endpoints/accounts/domains.test.js +6 -8
  46. package/test/endpoints/accounts/exchange-rates.test.js +3 -3
  47. package/test/endpoints/accounts/exchange-receipts.test.js +3 -3
  48. package/test/endpoints/accounts/images.test.js +2 -2
  49. package/test/endpoints/accounts/interline.test.js +10 -12
  50. package/test/endpoints/accounts/network.test.js +3 -5
  51. package/test/endpoints/accounts/people-lookups.test.js +13 -13
  52. package/test/endpoints/accounts/print-templates.test.js +3 -3
  53. package/test/endpoints/accounts/printers.test.js +2 -2
  54. package/test/endpoints/accounts/tokens.js +2 -2
  55. package/test/endpoints/accounts/trusted-machines.test.js +2 -2
  56. package/test/endpoints/accounts/websales-config.test.js +47 -50
  57. package/test/endpoints/btrzpay/carpointe.tests.js +2 -2
  58. package/test/endpoints/btrzpay/datalogicPayments.tests.js +2 -2
  59. package/test/endpoints/btrzpay/datalogicReferenceNumber.tests.js +2 -2
  60. package/test/endpoints/btrzpay/oxxoPayments.tests.js +2 -2
  61. package/test/endpoints/btrzpay/oxxoToken.tests.js +2 -2
  62. package/test/endpoints/btrzpay/payment-methods.test.js +3 -3
  63. package/test/endpoints/btrzpay/payments.tests.js +6 -6
  64. package/test/endpoints/btrzpay/reference-numbers.test.js +5 -5
  65. package/test/endpoints/btrzpay/referenced-payments.test.js +2 -2
  66. package/test/endpoints/btrzpay/square.tests.js +2 -2
  67. package/test/endpoints/btrzpay/terminalPayments.tests.js +2 -2
  68. package/test/endpoints/endpoints_helpers.test.js +28 -24
  69. package/test/endpoints/inventory/amenities.test.js +20 -20
  70. package/test/endpoints/inventory/amenity-groups.test.js +15 -15
  71. package/test/endpoints/inventory/bare-routes.test.js +2 -2
  72. package/test/endpoints/inventory/brands.test.js +9 -9
  73. package/test/endpoints/inventory/bundle-fares.test.js +10 -11
  74. package/test/endpoints/inventory/bundles.test.js +9 -9
  75. package/test/endpoints/inventory/companies.test.js +6 -6
  76. package/test/endpoints/inventory/custom-content.test.js +4 -4
  77. package/test/endpoints/inventory/custom-fields.test.js +2 -2
  78. package/test/endpoints/inventory/document-types.test.js +2 -2
  79. package/test/endpoints/inventory/fare-classes.test.js +10 -10
  80. package/test/endpoints/inventory/fares.test.js +14 -16
  81. package/test/endpoints/inventory/fees.test.js +14 -15
  82. package/test/endpoints/inventory/filtered-trips-v2.test.js +5 -5
  83. package/test/endpoints/inventory/insurances.test.js +2 -2
  84. package/test/endpoints/inventory/insurancesCost.test.js +2 -2
  85. package/test/endpoints/inventory/journey-prices.test.js +13 -15
  86. package/test/endpoints/inventory/labels.test.js +2 -2
  87. package/test/endpoints/inventory/marital-status.test.js +2 -2
  88. package/test/endpoints/inventory/mit-terminal-settings.test.js +2 -2
  89. package/test/endpoints/inventory/mit-terminals.test.js +7 -7
  90. package/test/endpoints/inventory/operating-companies.test.js +14 -14
  91. package/test/endpoints/inventory/operation-messages.test.js +10 -10
  92. package/test/endpoints/inventory/parcel-zones.test.js +12 -13
  93. package/test/endpoints/inventory/payment-terminals.test.js +7 -7
  94. package/test/endpoints/inventory/prisma-terminals.test.js +2 -2
  95. package/test/endpoints/inventory/products.test.js +25 -20
  96. package/test/endpoints/inventory/promos.test.js +50 -50
  97. package/test/endpoints/inventory/seatclasses.test.js +2 -2
  98. package/test/endpoints/inventory/seatfees.test.js +6 -6
  99. package/test/endpoints/inventory/seatmaps.test.js +7 -7
  100. package/test/endpoints/inventory/segments-information.test.js +2 -2
  101. package/test/endpoints/inventory/service-numbers.test.js +6 -6
  102. package/test/endpoints/inventory/service-types.test.js +7 -7
  103. package/test/endpoints/inventory/shift-settings.test.js +2 -2
  104. package/test/endpoints/inventory/ssrs.test.js +10 -11
  105. package/test/endpoints/inventory/stations-zones.test.js +8 -9
  106. package/test/endpoints/inventory/stations.test.js +2 -2
  107. package/test/endpoints/inventory/travel-routes.test.js +2 -2
  108. package/test/endpoints/inventory/traveller-car-types.test.js +8 -8
  109. package/test/endpoints/inventory/traveller-card-providers-types.test.js +2 -2
  110. package/test/endpoints/inventory/traveller-card-providers.test.js +7 -7
  111. package/test/endpoints/inventory/vehicles.test.js +2 -2
  112. package/test/endpoints/inventory/zone-price-overages.test.js +2 -2
  113. package/test/endpoints/inventory/zone-prices.test.js +2 -2
  114. package/test/endpoints/invoices/dlink.test.js +2 -2
  115. package/test/endpoints/invoices/gti.test.js +2 -2
  116. package/test/endpoints/invoices/infile.test.js +2 -2
  117. package/test/endpoints/invoices/infileJson.test.js +2 -2
  118. package/test/endpoints/invoices/providers.test.js +4 -4
  119. package/test/endpoints/invoices/providersSequences.test.js +2 -2
  120. package/test/endpoints/invoices/system.test.js +2 -2
  121. package/test/endpoints/loyalty/movements.test.js +11 -11
  122. package/test/endpoints/loyalty/programs.test.js +21 -21
  123. package/test/endpoints/notifications/customers.test.js +6 -6
  124. package/test/endpoints/notifications/external-customers.test.js +10 -10
  125. package/test/endpoints/notifications/manifet-notifications.test.js +3 -3
  126. package/test/endpoints/notifications/notify.test.js +5 -5
  127. package/test/endpoints/notifications/orders-rules-validations.test.js +5 -6
  128. package/test/endpoints/notifications/pdf-data.test.js +4 -4
  129. package/test/endpoints/notifications/pdfs.test.js +4 -4
  130. package/test/endpoints/notifications/printed-tickets.test.js +17 -18
  131. package/test/endpoints/notifications/short-urls.test.js +9 -9
  132. package/test/endpoints/operations/applied_insurance.test.js +10 -14
  133. package/test/endpoints/operations/calendar_entries.test.js +8 -9
  134. package/test/endpoints/operations/cancellation_settings.test.js +2 -2
  135. package/test/endpoints/operations/loans.test.js +2 -2
  136. package/test/endpoints/operations/manifest.test.js +11 -9
  137. package/test/endpoints/operations/operations.test.js +42 -25
  138. package/test/endpoints/operations/parcel_manifests.test.js +3 -3
  139. package/test/endpoints/operations/parcels.test.js +27 -22
  140. package/test/endpoints/operations/passenger_check_in_info.test.js +2 -2
  141. package/test/endpoints/operations/redemption.test.js +2 -2
  142. package/test/endpoints/operations/sold-items-fulfillment.test.js +2 -2
  143. package/test/endpoints/operations/sold_items.test.js +3 -3
  144. package/test/endpoints/operations/tickets.test.js +4 -4
  145. package/test/endpoints/operations/transaction.test.js +12 -15
  146. package/test/endpoints/operations/transactions.test.js +11 -11
  147. package/test/endpoints/operations/transport_regulations.js +2 -4
  148. package/test/endpoints/operations/trip_change_info.test.js +9 -10
  149. package/test/endpoints/operations/vehicle-assignments.test.js +5 -7
  150. package/test/endpoints/operations/waitlists.test.js +3 -3
  151. package/test/endpoints/ratality/auth.test.js +5 -5
  152. package/test/endpoints/ratality/client.test.js +4 -4
  153. package/test/endpoints/ratality/integrations.test.js +15 -9
  154. package/test/endpoints/reports/custom-reports.test.js +12 -12
  155. package/test/endpoints/reports/email.test.js +3 -3
  156. package/test/endpoints/reports/report-types.test.js +6 -6
  157. package/test/endpoints/reports/trip-manifests.test.js +5 -6
  158. package/test/endpoints/sales/bundles.test.js +9 -10
  159. package/test/endpoints/sales/cart-promo.test.js +15 -16
  160. package/test/endpoints/sales/cart.test.js +7 -7
  161. package/test/endpoints/sales/check-in-info.test.js +3 -3
  162. package/test/endpoints/sales/custom-fields.test.js +10 -13
  163. package/test/endpoints/sales/flexpasses.test.js +2 -2
  164. package/test/endpoints/sales/git-certificates.test.js +10 -13
  165. package/test/endpoints/sales/order.test.js +19 -21
  166. package/test/endpoints/sales/payment-providers.test.js +14 -15
  167. package/test/endpoints/sales/redeemable-items.test.js +14 -15
  168. package/test/endpoints/sales/sync-entry.test.js +9 -11
  169. package/test/endpoints/sales/voucher.test.js +19 -17
  170. package/test/endpoints/seatmaps/access-ticket.test.js +6 -6
  171. package/test/endpoints/seatmaps/seat.test.js +6 -6
  172. package/test/endpoints/uploads/files.test.js +8 -7
  173. package/test/endpoints/uploads/images.test.js +8 -7
  174. package/test/endpoints/webhooks/subscriptions.test.js +27 -27
  175. package/test/endpoints/webhooks/undelivered.test.js +22 -22
  176. package/test/endpoints/webhooks/webhooks.test.js +7 -7
  177. package/test/node-test-globals.js +19 -0
  178. package/test/test-helpers.js +4 -4
  179. package/test-integration/all.test.js +63 -0
  180. package/test-integration/endpoints/accounts/current-shifts.test.js +4 -4
  181. package/test-integration/endpoints/accounts/docs.test.js +6 -6
  182. package/test-integration/endpoints/accounts/lexicons.test.js +42 -37
  183. package/test-integration/endpoints/accounts/shifts.test.js +5 -8
  184. package/test-integration/endpoints/accounts/users.test.js +4 -4
  185. package/test-integration/endpoints/btrzpay/customerCards.test.js +24 -48
  186. package/test-integration/endpoints/btrzpay/customers.test.js +20 -34
  187. package/test-integration/endpoints/btrzpay/payment-methods.test.js +34 -34
  188. package/test-integration/endpoints/btrzpay/payments.test.js +21 -21
  189. package/test-integration/endpoints/btrzpay/reference-numbers.test.js +15 -15
  190. package/test-integration/endpoints/btrzpay/referenced-payments.test.js +5 -5
  191. package/test-integration/endpoints/client.test.js +6 -10
  192. package/test-integration/endpoints/inventory/amenities.test.js +34 -34
  193. package/test-integration/endpoints/inventory/amenity-groups.test.js +30 -31
  194. package/test-integration/endpoints/inventory/bundle-fares.test.js +10 -12
  195. package/test-integration/endpoints/inventory/companies.test.js +7 -8
  196. package/test-integration/endpoints/inventory/countries.test.js +10 -12
  197. package/test-integration/endpoints/inventory/custom-fields.test.js +2 -2
  198. package/test-integration/endpoints/inventory/docs.test.js +5 -7
  199. package/test-integration/endpoints/inventory/fare-classes.test.js +12 -13
  200. package/test-integration/endpoints/inventory/fares.test.js +7 -9
  201. package/test-integration/endpoints/inventory/fees.test.js +8 -10
  202. package/test-integration/endpoints/inventory/filtered-trips.test.js +15 -12
  203. package/test-integration/endpoints/inventory/gift-certificate-definitions.test.js +5 -5
  204. package/test-integration/endpoints/inventory/insurances.test.js +36 -34
  205. package/test-integration/endpoints/inventory/items.js +10 -12
  206. package/test-integration/endpoints/inventory/journey-prices.test.js +11 -11
  207. package/test-integration/endpoints/inventory/parcel-zones.test.js +15 -18
  208. package/test-integration/endpoints/inventory/products.test.js +12 -14
  209. package/test-integration/endpoints/inventory/promos.test.js +46 -42
  210. package/test-integration/endpoints/inventory/routes.test.js +13 -15
  211. package/test-integration/endpoints/inventory/schedule-groups.test.js +23 -23
  212. package/test-integration/endpoints/inventory/ssrs.test.js +16 -11
  213. package/test-integration/endpoints/inventory/stations-zones.test.js +5 -6
  214. package/test-integration/endpoints/inventory/stations.test.js +17 -20
  215. package/test-integration/endpoints/inventory/trips.test.js +30 -16
  216. package/test-integration/endpoints/notifications/printed-tickets.test.js +2 -2
  217. package/test-integration/endpoints/operations/applied_insurance.test.js +9 -11
  218. package/test-integration/endpoints/operations/manifest.test.js +32 -34
  219. package/test-integration/endpoints/operations/parcel.test.js +36 -38
  220. package/test-integration/endpoints/operations/redemption.test.js +9 -12
  221. package/test-integration/endpoints/operations/segments.js +8 -10
  222. package/test-integration/endpoints/operations/tickets.test.js +11 -11
  223. package/test-integration/endpoints/operations/transaction.test.js +1 -1
  224. package/test-integration/endpoints/operations/transactions.test.js +2 -2
  225. package/test-integration/endpoints/operations/trip_change_info.test.js +11 -13
  226. package/test-integration/endpoints/reports/custom-reports.test.js +21 -21
  227. package/test-integration/endpoints/reports/report-types.test.js +22 -22
  228. package/test-integration/endpoints/sales/bundles.test.js +5 -5
  229. package/test-integration/endpoints/sales/cart-promo.test.js +17 -32
  230. package/test-integration/endpoints/sales/cart.test.js +45 -51
  231. package/test-integration/endpoints/sales/check-in-info.test.js +2 -2
  232. package/test-integration/endpoints/sales/custom-fields.test.js +8 -10
  233. package/test-integration/endpoints/sales/flexpasses.test.js +2 -2
  234. package/test-integration/endpoints/sales/gift-certificates.test.js +14 -18
  235. package/test-integration/endpoints/sales/order.test.js +42 -50
  236. package/test-integration/endpoints/sales/payment-providers.test.js +7 -9
  237. package/test-integration/endpoints/sales/redeemable-items.test.js +17 -19
  238. package/test-integration/endpoints/sales/voucher.test.js +12 -14
  239. package/test-integration/endpoints/seatmaps/access-ticket.test.js +7 -9
  240. package/test-integration/endpoints/seatmaps/seat.test.js +7 -9
  241. package/test-integration/endpoints/uploads/files.test.js +14 -14
  242. package/test-integration/endpoints/uploads/images.test.js +3 -5
  243. package/test-integration/ports.js +4 -4
  244. package/test-integration/test-integration-helpers.js +13 -9
@@ -1,13 +1,13 @@
1
- const {expect} = require("chai");
1
+ const assert = require("node:assert/strict");
2
2
  const MockAdapter = require("axios-mock-adapter");
3
3
 
4
4
  const {createApiClient} = require("./../src/client.js");
5
5
  const {createTestServer, axiosMock} = require("./test-helpers.js");
6
6
 
7
7
  function expectKnownEndpoints(api) {
8
- expect(api.inventory.products).to.exist;
9
- expect(api.inventory.insurances).to.exist;
10
- expect(api.inventory.trips).to.exist;
8
+ assert.ok(api.inventory.products);
9
+ assert.ok(api.inventory.insurances);
10
+ assert.ok(api.inventory.trips);
11
11
  }
12
12
 
13
13
  describe("client", () => {
@@ -17,16 +17,16 @@ describe("client", () => {
17
17
  const api = createApiClient();
18
18
 
19
19
  expectKnownEndpoints(api);
20
- expect(api.inventory.__test.client.defaults.baseURL).to.eql("https://api.betterez.com/inventory");
21
- expect(api.inventory.__test.client.defaults.timeout).to.eql(15000);
20
+ assert.deepStrictEqual(api.inventory.__test.client.defaults.baseURL, "https://api.betterez.com/inventory");
21
+ assert.deepStrictEqual(api.inventory.__test.client.defaults.timeout, 15000);
22
22
  });
23
23
 
24
24
  it("should create a client with default values", () => {
25
25
  const api = createApiClient({baseURL});
26
26
 
27
27
  expectKnownEndpoints(api);
28
- expect(api.inventory.__test.client.defaults.baseURL).to.eql(baseURL);
29
- expect(api.inventory.__test.client.defaults.timeout).to.eql(0);
28
+ assert.deepStrictEqual(api.inventory.__test.client.defaults.baseURL, baseURL);
29
+ assert.deepStrictEqual(api.inventory.__test.client.defaults.timeout, 0);
30
30
  });
31
31
 
32
32
  it("should create a client that uses the provided default request headers when making a request to any subsystem", () => {
@@ -37,13 +37,15 @@ describe("client", () => {
37
37
  return !ignoredApiProperties.includes(property);
38
38
  }
39
39
  for (const subsystem of Object.keys(api).filter(propertyIsRelevant)) {
40
- expect(api[subsystem].__test.client.defaults.headers).to.include({"x-amzn-trace-id": "some_value"});
40
+ Object.entries({"x-amzn-trace-id": "some_value"}).forEach(([k, v]) => {
41
+ assert.deepStrictEqual(api[subsystem].__test.client.defaults.headers[k], v);
42
+ });
41
43
  }
42
44
  });
43
45
 
44
46
  it("should expose a INTERNAL_AUTH_TOKEN constant", () => {
45
47
  const api = createApiClient({baseURL});
46
- expect(api.constants.INTERNAL_AUTH_TOKEN_SYMBOL).to.be.eql("internal_auth_token");
48
+ assert.deepStrictEqual(api.constants.INTERNAL_AUTH_TOKEN_SYMBOL, "internal_auth_token");
47
49
  });
48
50
 
49
51
  it("should allow to override baseUrl for custom endpoints", () => {
@@ -56,12 +58,12 @@ describe("client", () => {
56
58
  }
57
59
  }
58
60
  });
59
- expect(api.inventory.products).to.exist;
60
- expect(api.inventory.insurances).to.exist;
61
+ assert.ok(api.inventory.products);
62
+ assert.ok(api.inventory.insurances);
61
63
 
62
64
  expectKnownEndpoints(api);
63
- expect(api.inventory.__test.client.defaults.baseURL).to.eql(`${baseURL}/somePath`);
64
- expect(api.inventory.__test.client.defaults.timeout).to.eql(10);
65
+ assert.deepStrictEqual(api.inventory.__test.client.defaults.baseURL, `${baseURL}/somePath`);
66
+ assert.deepStrictEqual(api.inventory.__test.client.defaults.timeout, 10);
65
67
  });
66
68
 
67
69
  it("should allow a different baseUrl to be specified for trip search endpoints", () => {
@@ -75,18 +77,18 @@ describe("client", () => {
75
77
  });
76
78
 
77
79
  expectKnownEndpoints(api);
78
- expect(api.inventory.__test.client.defaults.baseURL).to.eql("http://localhost:3010/inventory");
79
- expect(api.inventory.__test_trips.client.defaults.baseURL).to.eql("http://localhost:3090/inventory");
80
+ assert.deepStrictEqual(api.inventory.__test.client.defaults.baseURL, "http://localhost:3010/inventory");
81
+ assert.deepStrictEqual(api.inventory.__test_trips.client.defaults.baseURL, "http://localhost:3090/inventory");
80
82
  });
81
83
 
82
84
  it("should allow to perform custom request on clean client", () => {
83
85
  const api = createApiClient({baseURL, timeout: 0});
84
- expect(api.inventory.products).to.exist;
85
- expect(api.inventory.insurances).to.exist;
86
+ assert.ok(api.inventory.products);
87
+ assert.ok(api.inventory.insurances);
86
88
 
87
89
  expectKnownEndpoints(api);
88
- expect(api._cleanClient.defaults.baseURL).to.eql(baseURL);
89
- expect(api._cleanClient.defaults.timeout).to.eql(0);
90
+ assert.deepStrictEqual(api._cleanClient.defaults.baseURL, baseURL);
91
+ assert.deepStrictEqual(api._cleanClient.defaults.timeout, 0);
90
92
 
91
93
  const mock = new MockAdapter(api._cleanClient);
92
94
  mock.onPost("/custom/endpoint").reply(200);
@@ -100,24 +102,28 @@ describe("client", () => {
100
102
  describe("with keepAlive enabled in a custom endpoint", () => {
101
103
  let mockServer = null;
102
104
 
103
- before((done) => {
105
+ before(async () => {
104
106
  axiosMock.restore();
105
107
  mockServer = createTestServer({
106
108
  host: "localhost",
107
109
  port: 8888,
108
110
  maxSockets: 10
109
111
  }, (req) => {
110
- expect(req.headers.connection).to.equal("keep-alive");
112
+ assert.deepStrictEqual(req.headers.connection, "keep-alive");
111
113
  });
112
- mockServer.create((err) => {
113
- if (err) return done(err);
114
- return done();
114
+ await new Promise((resolve, reject) => {
115
+ mockServer.create((err) => {
116
+ if (err) return reject(err);
117
+ return resolve();
118
+ });
115
119
  });
116
120
  });
117
121
 
118
- after((done) => {
119
- mockServer.close(() => {
120
- done();
122
+ after(async () => {
123
+ await new Promise((resolve) => {
124
+ mockServer.close(() => {
125
+ resolve();
126
+ });
121
127
  });
122
128
  });
123
129
 
@@ -140,24 +146,28 @@ describe("client", () => {
140
146
  describe("with keepAlive enabled in a known endpoint", () => {
141
147
  let mockServer = null;
142
148
 
143
- before((done) => {
149
+ before(async () => {
144
150
  axiosMock.restore();
145
151
  mockServer = createTestServer({
146
152
  host: "localhost",
147
153
  port: 8888,
148
154
  maxSockets: 10
149
155
  }, (req) => {
150
- expect(req.headers.connection).to.equal("keep-alive");
156
+ assert.deepStrictEqual(req.headers.connection, "keep-alive");
151
157
  });
152
- mockServer.create((err) => {
153
- if (err) return done(err);
154
- return done();
158
+ await new Promise((resolve, reject) => {
159
+ mockServer.create((err) => {
160
+ if (err) return reject(err);
161
+ return resolve();
162
+ });
155
163
  });
156
164
  });
157
165
 
158
- after((done) => {
159
- mockServer.close(() => {
160
- done();
166
+ after(async () => {
167
+ await new Promise((resolve) => {
168
+ mockServer.close(() => {
169
+ resolve();
170
+ });
161
171
  });
162
172
  });
163
173
 
@@ -180,24 +190,28 @@ describe("client", () => {
180
190
  describe.skip("with keepAlive disabled (default)", () => {
181
191
  let mockServer = null;
182
192
 
183
- before((done) => {
193
+ before(async () => {
184
194
  axiosMock.restore();
185
195
  mockServer = createTestServer({
186
196
  host: "localhost",
187
197
  port: 8888,
188
198
  maxSockets: 120
189
199
  }, (req) => {
190
- expect(req.headers.connection).to.equal("close");
200
+ assert.deepStrictEqual(req.headers.connection, "close");
191
201
  });
192
- mockServer.create((err) => {
193
- if (err) return done(err);
194
- return done();
202
+ await new Promise((resolve, reject) => {
203
+ mockServer.create((err) => {
204
+ if (err) return reject(err);
205
+ return resolve();
206
+ });
195
207
  });
196
208
  });
197
209
 
198
- after((done) => {
199
- mockServer.close(() => {
200
- done();
210
+ after(async () => {
211
+ await new Promise((resolve) => {
212
+ mockServer.close(() => {
213
+ resolve();
214
+ });
201
215
  });
202
216
  });
203
217
 
@@ -1,5 +1,5 @@
1
- const {axiosMock, expectRequest} = require("./../../test-helpers");
2
- const api = require("./../../../src/client").createApiClient({baseURL: "http://test.com"});
1
+ const {axiosMock, expectRequest} = require("./../../test-helpers.js");
2
+ const api = require("./../../../src/client.js").createApiClient({baseURL: "http://test.com"});
3
3
 
4
4
  describe("accounts/application-settings/:providerId", () => {
5
5
  const token = "I owe you a token";
@@ -1,5 +1,5 @@
1
- const {axiosMock, expectRequest} = require("./../../test-helpers");
2
- const api = require("./../../../src/client").createApiClient({baseURL: "http://test.com"});
1
+ const {axiosMock, expectRequest} = require("./../../test-helpers.js");
2
+ const api = require("./../../../src/client.js").createApiClient({baseURL: "http://test.com"});
3
3
 
4
4
  describe("accounts/applications/:id", () => {
5
5
  const token = "I owe you a token";
@@ -1,5 +1,5 @@
1
- const {axiosMock, expectRequest} = require("./../../test-helpers");
2
- const api = require("./../../../src/client").createApiClient({baseURL: "http://test.com"});
1
+ const {axiosMock, expectRequest} = require("./../../test-helpers.js");
2
+ const api = require("./../../../src/client.js").createApiClient({baseURL: "http://test.com"});
3
3
 
4
4
  describe("accounts/users/:userId/current-shift", () => {
5
5
  const token = "I owe you a token";
@@ -1,7 +1,7 @@
1
- const {expect} = require("chai");
1
+ const assert = require("node:assert/strict");
2
2
  const base64 = require("base-64");
3
- const {axiosMock, expectRequest} = require("./../../test-helpers");
4
- const api = require("./../../../src/client").createApiClient({baseURL: "http://test.com"});
3
+ const {axiosMock, expectRequest} = require("./../../test-helpers.js");
4
+ const api = require("./../../../src/client.js").createApiClient({baseURL: "http://test.com"});
5
5
 
6
6
  describe("accounts/customers", () => {
7
7
  const token = "I owe you a token";
@@ -57,8 +57,8 @@ describe("accounts/customers", () => {
57
57
  axiosMock.onPost("/customers/cas", {
58
58
  service, ticket
59
59
  }).reply((response) => {
60
- expect(response.data).to.be.eql(`{"service":"${service}","ticket":"${ticket}"}`);
61
- expect(response.headers["x-api-key"]).to.be.eql(token);
60
+ assert.deepStrictEqual(response.data, `{"service":"${service}","ticket":"${ticket}"}`);
61
+ assert.deepStrictEqual(response.headers["x-api-key"], token);
62
62
  return [200];
63
63
  });
64
64
 
@@ -81,17 +81,17 @@ describe("accounts/customers", () => {
81
81
  };
82
82
 
83
83
  axiosMock.onPost("/customers").reply((config) => {
84
- expect(config.params).eql({
84
+ assert.deepStrictEqual(config.params, {
85
85
  "x-api-key": apiKey
86
86
  });
87
- expect(config.headers.Authorization).eql(`Basic ${encodedCredentials}`);
87
+ assert.deepStrictEqual(config.headers.Authorization, `Basic ${encodedCredentials}`);
88
88
  return [200, response];
89
89
  });
90
90
 
91
91
  return api.accounts.customers.signIn({email, password, apiKey})
92
92
  .then((httpResponse) => {
93
- expect(httpResponse.status).eql(200);
94
- expect(httpResponse.data).eql(response);
93
+ assert.deepStrictEqual(httpResponse.status, 200);
94
+ assert.deepStrictEqual(httpResponse.data, response);
95
95
  });
96
96
  });
97
97
 
@@ -113,15 +113,15 @@ describe("accounts/customers", () => {
113
113
  };
114
114
 
115
115
  axiosMock.onPatch(`/customers/${customerId}`).reply((config) => {
116
- expect(config.headers.authorization).eql(`Bearer ${jwtToken}`);
117
- expect(config.headers["x-api-key"]).eql(token);
116
+ assert.deepStrictEqual(config.headers.authorization, `Bearer ${jwtToken}`);
117
+ assert.deepStrictEqual(config.headers["x-api-key"], token);
118
118
  return [200, response];
119
119
  });
120
120
 
121
121
  return api.accounts.customers.update({customerId, token, jwtToken, data})
122
122
  .then((httpResponse) => {
123
- expect(httpResponse.status).eql(200);
124
- expect(httpResponse.data).eql(response);
123
+ assert.deepStrictEqual(httpResponse.status, 200);
124
+ assert.deepStrictEqual(httpResponse.data, response);
125
125
  });
126
126
  });
127
127
 
@@ -136,15 +136,15 @@ describe("accounts/customers", () => {
136
136
  };
137
137
 
138
138
  axiosMock.onPost("/customers/merge", data).reply((config) => {
139
- expect(config.headers.authorization).eql(`Bearer ${jwtToken}`);
140
- expect(config.headers["x-api-key"]).eql(token);
139
+ assert.deepStrictEqual(config.headers.authorization, `Bearer ${jwtToken}`);
140
+ assert.deepStrictEqual(config.headers["x-api-key"], token);
141
141
  return [200, response];
142
142
  });
143
143
 
144
144
  return api.accounts.customers.merge({destinationCustomerId, sourceCustomerIds, token, jwtToken})
145
145
  .then((httpResponse) => {
146
- expect(httpResponse.status).eql(200);
147
- expect(httpResponse.data).eql(response);
146
+ assert.deepStrictEqual(httpResponse.status, 200);
147
+ assert.deepStrictEqual(httpResponse.data, response);
148
148
  });
149
149
  });
150
150
  });
@@ -1,8 +1,6 @@
1
- const {axiosMock, expectRequest} = require("../../test-helpers");
2
- const api = require("../../../src/client").createApiClient({baseURL: "http://test.com"});
3
- const {
4
- expect
5
- } = require("chai");
1
+ const {axiosMock, expectRequest} = require("../../test-helpers.js");
2
+ const api = require("../../../src/client.js").createApiClient({baseURL: "http://test.com"});
3
+ const assert = require("node:assert/strict");
6
4
 
7
5
  describe("accounts/domains", () => {
8
6
  const token = "I owe you a token";
@@ -20,7 +18,7 @@ describe("accounts/domains", () => {
20
18
  return api.accounts.domains.all({
21
19
  token
22
20
  }).then((httpResponse) => {
23
- expect(httpResponse.status).eql(200);
21
+ assert.deepStrictEqual(httpResponse.status, 200);
24
22
  });
25
23
  });
26
24
 
@@ -38,7 +36,7 @@ describe("accounts/domains", () => {
38
36
  jwtToken,
39
37
  data
40
38
  }).then((httpResponse) => {
41
- expect(httpResponse.status).eql(200);
39
+ assert.deepStrictEqual(httpResponse.status, 200);
42
40
  });
43
41
  });
44
42
 
@@ -55,7 +53,7 @@ describe("accounts/domains", () => {
55
53
  token,
56
54
  jwtToken
57
55
  }).then((httpResponse) => {
58
- expect(httpResponse.status).eql(204);
56
+ assert.deepStrictEqual(httpResponse.status, 204);
59
57
  });
60
58
  });
61
59
  });
@@ -1,4 +1,4 @@
1
- const {expect} = require("chai");
1
+ const assert = require("node:assert/strict");
2
2
  const {axiosMock, expectRequest} = require("./../../test-helpers.js");
3
3
  const api = require("./../../../src/client.js").createApiClient({baseURL: "http://test.com"});
4
4
 
@@ -21,7 +21,7 @@ describe("accounts/exchange-rates", () => {
21
21
  jwtToken,
22
22
  isoCode
23
23
  }).then((httpResponse) => {
24
- expect(httpResponse.status).eql(200);
24
+ assert.deepStrictEqual(httpResponse.status, 200);
25
25
  });
26
26
  });
27
27
 
@@ -39,7 +39,7 @@ describe("accounts/exchange-rates", () => {
39
39
  jwtToken,
40
40
  data
41
41
  }).then((httpResponse) => {
42
- expect(httpResponse.status).eql(200);
42
+ assert.deepStrictEqual(httpResponse.status, 200);
43
43
  });
44
44
  });
45
45
  });
@@ -1,4 +1,4 @@
1
- const {expect} = require("chai");
1
+ const assert = require("node:assert/strict");
2
2
  const {axiosMock, expectRequest} = require("../../test-helpers.js");
3
3
  const api = require("../../../src/client.js").createApiClient({baseURL: "http://test.com"});
4
4
 
@@ -24,7 +24,7 @@ describe("accounts/exchange-receipt-settings", () => {
24
24
  jwtToken,
25
25
  data
26
26
  }).then((httpResponse) => {
27
- expect(httpResponse.status).eql(200);
27
+ assert.deepStrictEqual(httpResponse.status, 200);
28
28
  });
29
29
  });
30
30
 
@@ -38,7 +38,7 @@ describe("accounts/exchange-receipt-settings", () => {
38
38
  token,
39
39
  jwtToken
40
40
  }).then((httpResponse) => {
41
- expect(httpResponse.status).eql(200);
41
+ assert.deepStrictEqual(httpResponse.status, 200);
42
42
  });
43
43
  });
44
44
  });
@@ -1,5 +1,5 @@
1
- const {axiosMock, expectRequest} = require("./../../test-helpers");
2
- const api = require("./../../../src/client").createApiClient({baseURL: "http://test.com"});
1
+ const {axiosMock, expectRequest} = require("./../../test-helpers.js");
2
+ const api = require("./../../../src/client.js").createApiClient({baseURL: "http://test.com"});
3
3
 
4
4
  describe("accounts/images", () => {
5
5
  const token = "I owe you a token";
@@ -1,6 +1,4 @@
1
- const {
2
- expect
3
- } = require("chai");
1
+ const assert = require("node:assert/strict");
4
2
  const {
5
3
  axiosMock,
6
4
  expectRequest
@@ -23,7 +21,7 @@ describe("accounts/interline", () => {
23
21
  return api.accounts.interline.invitations.all({
24
22
  token
25
23
  }).then((httpResponse) => {
26
- expect(httpResponse.status).eql(200);
24
+ assert.deepStrictEqual(httpResponse.status, 200);
27
25
  });
28
26
  });
29
27
 
@@ -38,7 +36,7 @@ describe("accounts/interline", () => {
38
36
  invitationId,
39
37
  token
40
38
  }).then((httpResponse) => {
41
- expect(httpResponse.status).eql(200);
39
+ assert.deepStrictEqual(httpResponse.status, 200);
42
40
  });
43
41
  });
44
42
 
@@ -56,7 +54,7 @@ describe("accounts/interline", () => {
56
54
  jwtToken,
57
55
  data
58
56
  }).then((httpResponse) => {
59
- expect(httpResponse.status).eql(200);
57
+ assert.deepStrictEqual(httpResponse.status, 200);
60
58
  });
61
59
  });
62
60
 
@@ -76,7 +74,7 @@ describe("accounts/interline", () => {
76
74
  jwtToken,
77
75
  data
78
76
  }).then((httpResponse) => {
79
- expect(httpResponse.status).eql(200);
77
+ assert.deepStrictEqual(httpResponse.status, 200);
80
78
  });
81
79
  });
82
80
 
@@ -93,7 +91,7 @@ describe("accounts/interline", () => {
93
91
  token,
94
92
  jwtToken
95
93
  }).then((httpResponse) => {
96
- expect(httpResponse.status).eql(204);
94
+ assert.deepStrictEqual(httpResponse.status, 204);
97
95
  });
98
96
  });
99
97
 
@@ -105,7 +103,7 @@ describe("accounts/interline", () => {
105
103
  return api.accounts.interline.providers.all({
106
104
  token
107
105
  }).then((httpResponse) => {
108
- expect(httpResponse.status).eql(200);
106
+ assert.deepStrictEqual(httpResponse.status, 200);
109
107
  });
110
108
  });
111
109
 
@@ -117,7 +115,7 @@ describe("accounts/interline", () => {
117
115
  return api.accounts.interline.consumers.all({
118
116
  token
119
117
  }).then((httpResponse) => {
120
- expect(httpResponse.status).eql(200);
118
+ assert.deepStrictEqual(httpResponse.status, 200);
121
119
  });
122
120
  });
123
121
 
@@ -136,7 +134,7 @@ describe("accounts/interline", () => {
136
134
 
137
135
  return api.accounts.interline.network.update({interlineId, token, jwtToken, data})
138
136
  .then((httpResponse) => {
139
- expect(httpResponse.status).eql(200);
137
+ assert.deepStrictEqual(httpResponse.status, 200);
140
138
  });
141
139
  });
142
140
 
@@ -151,7 +149,7 @@ describe("accounts/interline", () => {
151
149
  interlineId,
152
150
  token
153
151
  }).then((httpResponse) => {
154
- expect(httpResponse.status).eql(200);
152
+ assert.deepStrictEqual(httpResponse.status, 200);
155
153
  });
156
154
  });
157
155
  });
@@ -1,6 +1,4 @@
1
- const {
2
- expect
3
- } = require("chai");
1
+ const assert = require("node:assert/strict");
4
2
  const {
5
3
  axiosMock,
6
4
  expectRequest
@@ -25,7 +23,7 @@ describe("accounts/interline", () => {
25
23
  token,
26
24
  jwtToken
27
25
  }).then((httpResponse) => {
28
- expect(httpResponse.status).eql(200);
26
+ assert.deepStrictEqual(httpResponse.status, 200);
29
27
  });
30
28
  });
31
29
 
@@ -40,7 +38,7 @@ describe("accounts/interline", () => {
40
38
  sellerId: "sellerId",
41
39
  jwtToken
42
40
  }).then((httpResponse) => {
43
- expect(httpResponse.status).eql(200);
41
+ assert.deepStrictEqual(httpResponse.status, 200);
44
42
  });
45
43
  });
46
44
 
@@ -1,6 +1,6 @@
1
1
  const {axiosMock, expectRequest} = require("./../../test-helpers.js");
2
2
  const api = require("./../../../src/client.js").createApiClient({baseURL: "http://test.com"});
3
- const expect = require("chai").expect;
3
+ const assert = require("node:assert/strict");
4
4
 
5
5
 
6
6
  describe("accounts/people-lookups", () => {
@@ -65,9 +65,9 @@ describe("accounts/people-lookups", () => {
65
65
  jwtToken, token, personId, person
66
66
  })
67
67
  .then((res) => {
68
- expect(res.config.params).to.eql({});
69
- expect(res.config.data).to.eql(JSON.stringify({person}));
70
- expect(res.status).to.equals(200);
68
+ assert.deepStrictEqual(res.config.params, {});
69
+ assert.deepStrictEqual(res.config.data, JSON.stringify({person}));
70
+ assert.deepStrictEqual(res.status, 200);
71
71
  });
72
72
  });
73
73
 
@@ -87,9 +87,9 @@ describe("accounts/people-lookups", () => {
87
87
  jwtToken, token, personId, person, providerId
88
88
  })
89
89
  .then((res) => {
90
- expect(res.config.params).to.eql({providerId});
91
- expect(res.config.data).to.eql(JSON.stringify({person}));
92
- expect(res.status).to.equals(200);
90
+ assert.deepStrictEqual(res.config.params, {providerId});
91
+ assert.deepStrictEqual(res.config.data, JSON.stringify({person}));
92
+ assert.deepStrictEqual(res.status, 200);
93
93
  });
94
94
  });
95
95
 
@@ -109,9 +109,9 @@ describe("accounts/people-lookups", () => {
109
109
  token, jwtToken, person
110
110
  })
111
111
  .then((res) => {
112
- expect(res.config.params).to.eql({});
113
- expect(res.config.data).to.eql(JSON.stringify({person}));
114
- expect(res.status).to.equals(200);
112
+ assert.deepStrictEqual(res.config.params, {});
113
+ assert.deepStrictEqual(res.config.data, JSON.stringify({person}));
114
+ assert.deepStrictEqual(res.status, 200);
115
115
  });
116
116
  });
117
117
 
@@ -131,9 +131,9 @@ describe("accounts/people-lookups", () => {
131
131
  token, jwtToken, person, providerId
132
132
  })
133
133
  .then((res) => {
134
- expect(res.config.params).to.eql({providerId});
135
- expect(res.config.data).to.eql(JSON.stringify({person}));
136
- expect(res.status).to.equals(200);
134
+ assert.deepStrictEqual(res.config.params, {providerId});
135
+ assert.deepStrictEqual(res.config.data, JSON.stringify({person}));
136
+ assert.deepStrictEqual(res.status, 200);
137
137
  });
138
138
  });
139
139
 
@@ -1,5 +1,5 @@
1
- const {axiosMock, expectRequest} = require("./../../test-helpers");
2
- const api = require("./../../../src/client").createApiClient({baseURL: "http://test.com"});
1
+ const {axiosMock, expectRequest} = require("./../../test-helpers.js");
2
+ const api = require("./../../../src/client.js").createApiClient({baseURL: "http://test.com"});
3
3
 
4
4
  describe("accounts/accounts/print-templates", () => {
5
5
  const token = "I owe you a token";
@@ -60,7 +60,7 @@ describe("accounts/accounts/print-templates", () => {
60
60
  jwtToken
61
61
  }));
62
62
  return api.accounts.printTemplates.versions.update({
63
- token, jwtToken, query, versionId, printTemplateId, query
63
+ token, jwtToken, query, versionId, printTemplateId
64
64
  });
65
65
  });
66
66
 
@@ -1,5 +1,5 @@
1
- const {axiosMock, expectRequest} = require("./../../test-helpers");
2
- const api = require("./../../../src/client").createApiClient({baseURL: "http://test.com"});
1
+ const {axiosMock, expectRequest} = require("./../../test-helpers.js");
2
+ const api = require("./../../../src/client.js").createApiClient({baseURL: "http://test.com"});
3
3
 
4
4
  describe("accounts/printers", () => {
5
5
  const token = "I owe you a token";
@@ -1,5 +1,5 @@
1
- const {axiosMock, expectRequest} = require("./../../test-helpers");
2
- const api = require("./../../../src/client").createApiClient({baseURL: "http://test.com"});
1
+ const {axiosMock, expectRequest} = require("./../../test-helpers.js");
2
+ const api = require("./../../../src/client.js").createApiClient({baseURL: "http://test.com"});
3
3
 
4
4
  describe("accounts/tokens", () => {
5
5
  const token = "I owe you a token";
@@ -1,5 +1,5 @@
1
- const {axiosMock, expectRequest} = require("./../../test-helpers");
2
- const api = require("./../../../src/client").createApiClient({baseURL: "http://test.com"});
1
+ const {axiosMock, expectRequest} = require("./../../test-helpers.js");
2
+ const api = require("./../../../src/client.js").createApiClient({baseURL: "http://test.com"});
3
3
 
4
4
  describe("accounts/trusted-machines", () => {
5
5
  const token = "I owe you a token";