btrz-api-client 3.40.1 → 3.42.3

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 (140) hide show
  1. package/lib/client-standalone-min.js +1 -1
  2. package/lib/client.js +0 -1
  3. package/lib/endpoints/operations/manifest.js +38 -8
  4. package/lib/initializedClient.js +6 -0
  5. package/package.json +4 -2
  6. package/src/client.js +0 -1
  7. package/src/endpoints/operations/manifest.js +56 -16
  8. package/src/initializedClient.js +3 -0
  9. package/test/endpoints/operations/manifest.test.js +66 -17
  10. package/types/client.d.ts +2310 -0
  11. package/types/constants.d.ts +1 -0
  12. package/types/endpoints/accounts/accounts.d.ts +11 -0
  13. package/types/endpoints/accounts/application-settings.d.ts +38 -0
  14. package/types/endpoints/accounts/application.d.ts +11 -0
  15. package/types/endpoints/accounts/applications.d.ts +18 -0
  16. package/types/endpoints/accounts/current-shifts.d.ts +12 -0
  17. package/types/endpoints/accounts/customers.d.ts +45 -0
  18. package/types/endpoints/accounts/docs.d.ts +6 -0
  19. package/types/endpoints/accounts/domains.d.ts +23 -0
  20. package/types/endpoints/accounts/email-settings.d.ts +38 -0
  21. package/types/endpoints/accounts/exchange-rates.d.ts +19 -0
  22. package/types/endpoints/accounts/interline.d.ts +68 -0
  23. package/types/endpoints/accounts/lexicons.d.ts +30 -0
  24. package/types/endpoints/accounts/print-settings.d.ts +31 -0
  25. package/types/endpoints/accounts/printers.d.ts +11 -0
  26. package/types/endpoints/accounts/shifts.d.ts +11 -0
  27. package/types/endpoints/accounts/travellers.d.ts +41 -0
  28. package/types/endpoints/accounts/trusted-machines.d.ts +12 -0
  29. package/types/endpoints/accounts/users.d.ts +18 -0
  30. package/types/endpoints/btrzpay/customerCards.d.ts +37 -0
  31. package/types/endpoints/btrzpay/customers.d.ts +27 -0
  32. package/types/endpoints/btrzpay/docs.d.ts +6 -0
  33. package/types/endpoints/btrzpay/payment-methods.d.ts +45 -0
  34. package/types/endpoints/btrzpay/payments.d.ts +18 -0
  35. package/types/endpoints/btrzpay/reference-numbers.d.ts +12 -0
  36. package/types/endpoints/btrzpay/referenced-payments.d.ts +21 -0
  37. package/types/endpoints/btrzpay/square.d.ts +22 -0
  38. package/types/endpoints/coltrane/docs.d.ts +6 -0
  39. package/types/endpoints/coltrane/paths.d.ts +11 -0
  40. package/types/endpoints/endpoints_helpers.d.ts +9 -0
  41. package/types/endpoints/gps/scanner-app-location.d.ts +10 -0
  42. package/types/endpoints/inventory/amenities.d.ts +30 -0
  43. package/types/endpoints/inventory/amenity-groups.d.ts +30 -0
  44. package/types/endpoints/inventory/bare-routes.d.ts +17 -0
  45. package/types/endpoints/inventory/brands.d.ts +31 -0
  46. package/types/endpoints/inventory/bundle-fares.d.ts +13 -0
  47. package/types/endpoints/inventory/bundles.d.ts +18 -0
  48. package/types/endpoints/inventory/companies.d.ts +12 -0
  49. package/types/endpoints/inventory/countries.d.ts +11 -0
  50. package/types/endpoints/inventory/custom-content.d.ts +35 -0
  51. package/types/endpoints/inventory/docs.d.ts +6 -0
  52. package/types/endpoints/inventory/fare-classes.d.ts +25 -0
  53. package/types/endpoints/inventory/fares.d.ts +16 -0
  54. package/types/endpoints/inventory/fees.d.ts +11 -0
  55. package/types/endpoints/inventory/filtered-trips-v2.d.ts +12 -0
  56. package/types/endpoints/inventory/filtered-trips.d.ts +12 -0
  57. package/types/endpoints/inventory/gift-certificate-definitions.d.ts +11 -0
  58. package/types/endpoints/inventory/healthcheck.d.ts +7 -0
  59. package/types/endpoints/inventory/insurances.d.ts +35 -0
  60. package/types/endpoints/inventory/insurancesCost.d.ts +13 -0
  61. package/types/endpoints/inventory/items.d.ts +11 -0
  62. package/types/endpoints/inventory/journey-prices.d.ts +25 -0
  63. package/types/endpoints/inventory/marketplace-modifiers.d.ts +35 -0
  64. package/types/endpoints/inventory/operating-companies.d.ts +31 -0
  65. package/types/endpoints/inventory/operation-messages.d.ts +41 -0
  66. package/types/endpoints/inventory/parcel-zones.d.ts +24 -0
  67. package/types/endpoints/inventory/payment-terminals.d.ts +35 -0
  68. package/types/endpoints/inventory/products.d.ts +18 -0
  69. package/types/endpoints/inventory/promos.d.ts +51 -0
  70. package/types/endpoints/inventory/routes.d.ts +53 -0
  71. package/types/endpoints/inventory/schedules.d.ts +11 -0
  72. package/types/endpoints/inventory/seatfees.d.ts +29 -0
  73. package/types/endpoints/inventory/seatmaps.d.ts +15 -0
  74. package/types/endpoints/inventory/service-numbers.d.ts +31 -0
  75. package/types/endpoints/inventory/service-types.d.ts +35 -0
  76. package/types/endpoints/inventory/ssrs.d.ts +11 -0
  77. package/types/endpoints/inventory/station-groups.d.ts +11 -0
  78. package/types/endpoints/inventory/stations-zones.d.ts +11 -0
  79. package/types/endpoints/inventory/stations.d.ts +16 -0
  80. package/types/endpoints/inventory/taxes.d.ts +30 -0
  81. package/types/endpoints/inventory/traveller-card-providers-types.d.ts +11 -0
  82. package/types/endpoints/inventory/traveller-card-providers.d.ts +31 -0
  83. package/types/endpoints/inventory/traveller-card-types.d.ts +37 -0
  84. package/types/endpoints/inventory/trips.d.ts +17 -0
  85. package/types/endpoints/inventory/zone-price-overages.d.ts +35 -0
  86. package/types/endpoints/inventory/zone-prices.d.ts +35 -0
  87. package/types/endpoints/invoices/docs.d.ts +6 -0
  88. package/types/endpoints/invoices/emails.d.ts +13 -0
  89. package/types/endpoints/invoices/infile.d.ts +13 -0
  90. package/types/endpoints/invoices/pdfs.d.ts +13 -0
  91. package/types/endpoints/invoices/providers.d.ts +41 -0
  92. package/types/endpoints/invoices/tax-ids.d.ts +12 -0
  93. package/types/endpoints/loyalty/movements.d.ts +31 -0
  94. package/types/endpoints/loyalty/programs.d.ts +25 -0
  95. package/types/endpoints/notifications/customers.d.ts +12 -0
  96. package/types/endpoints/notifications/email.d.ts +12 -0
  97. package/types/endpoints/notifications/manifest-notifications.d.ts +18 -0
  98. package/types/endpoints/notifications/printed-tickets.d.ts +15 -0
  99. package/types/endpoints/operations/accounting_items.d.ts +16 -0
  100. package/types/endpoints/operations/applied_insurance.d.ts +12 -0
  101. package/types/endpoints/operations/calendar_entries.d.ts +11 -0
  102. package/types/endpoints/operations/docs.d.ts +6 -0
  103. package/types/endpoints/operations/flexpasses.d.ts +13 -0
  104. package/types/endpoints/operations/loans.d.ts +16 -0
  105. package/types/endpoints/operations/manifest.d.ts +68 -0
  106. package/types/endpoints/operations/movements.d.ts +13 -0
  107. package/types/endpoints/operations/outlook-trips.d.ts +10 -0
  108. package/types/endpoints/operations/parcels.d.ts +26 -0
  109. package/types/endpoints/operations/redemption.d.ts +19 -0
  110. package/types/endpoints/operations/scheduled_notifications.d.ts +38 -0
  111. package/types/endpoints/operations/segments.d.ts +14 -0
  112. package/types/endpoints/operations/tickets.d.ts +26 -0
  113. package/types/endpoints/operations/transaction.d.ts +13 -0
  114. package/types/endpoints/operations/transactions.d.ts +55 -0
  115. package/types/endpoints/operations/trip_change_info.d.ts +13 -0
  116. package/types/endpoints/operations/waitlists.d.ts +30 -0
  117. package/types/endpoints/reports/custom-reports.d.ts +24 -0
  118. package/types/endpoints/reports/report-types.d.ts +18 -0
  119. package/types/endpoints/sales/bundles.d.ts +11 -0
  120. package/types/endpoints/sales/cart-promo.d.ts +20 -0
  121. package/types/endpoints/sales/cart.d.ts +48 -0
  122. package/types/endpoints/sales/custom-fields.d.ts +11 -0
  123. package/types/endpoints/sales/docs.d.ts +6 -0
  124. package/types/endpoints/sales/flexpasses.d.ts +13 -0
  125. package/types/endpoints/sales/gift-certificates.d.ts +12 -0
  126. package/types/endpoints/sales/order.d.ts +18 -0
  127. package/types/endpoints/sales/payment-providers.d.ts +12 -0
  128. package/types/endpoints/sales/redeemable-items.d.ts +18 -0
  129. package/types/endpoints/sales/sync-entry.d.ts +12 -0
  130. package/types/endpoints/sales/voucher.d.ts +11 -0
  131. package/types/endpoints/seatmaps/access-ticket.d.ts +11 -0
  132. package/types/endpoints/seatmaps/seat.d.ts +12 -0
  133. package/types/endpoints/uploads/files.d.ts +11 -0
  134. package/types/endpoints/uploads/images.d.ts +11 -0
  135. package/types/endpoints/webhooks/events.d.ts +13 -0
  136. package/types/endpoints/webhooks/subscriptions.d.ts +38 -0
  137. package/types/endpoints/webhooks/undelivered.d.ts +36 -0
  138. package/types/endpoints/webhooks/webhooks.d.ts +12 -0
  139. package/types/initializedClient.d.ts +2264 -0
  140. package/types/productionDefaults.d.ts +6 -0
@@ -1,13 +1,12 @@
1
1
  "use strict";
2
2
 
3
- var _require = require("./../endpoints_helpers"),
3
+ var _require = require("./../endpoints_helpers.js"),
4
4
  authorizationHeaders = _require.authorizationHeaders;
5
5
 
6
6
  function manifestFactory(_ref) {
7
7
  var client = _ref.client,
8
8
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
9
9
 
10
-
11
10
  function get(_ref2) {
12
11
  var token = _ref2.token,
13
12
  jwtToken = _ref2.jwtToken,
@@ -32,7 +31,9 @@ function manifestFactory(_ref) {
32
31
  return client({
33
32
  url: "/manifests/" + manifestId,
34
33
  method: "get",
35
- headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
34
+ headers: authorizationHeaders({
35
+ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
36
+ })
36
37
  });
37
38
  }
38
39
 
@@ -64,7 +65,9 @@ function manifestFactory(_ref) {
64
65
  url: "/outlook-manifests",
65
66
  method: "get",
66
67
  params: query,
67
- headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
68
+ headers: authorizationHeaders({
69
+ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
70
+ })
68
71
  });
69
72
  }
70
73
 
@@ -81,7 +84,9 @@ function manifestFactory(_ref) {
81
84
  method: "patch",
82
85
  params: query,
83
86
  headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
84
- data: { operations: operations }
87
+ data: {
88
+ operations: operations
89
+ }
85
90
  });
86
91
  }
87
92
 
@@ -113,7 +118,9 @@ function manifestFactory(_ref) {
113
118
  return client({
114
119
  url: "/manifests/" + manifestId + "/users",
115
120
  method: "post",
116
- headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
121
+ headers: authorizationHeaders({
122
+ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
123
+ }),
117
124
  params: query,
118
125
  data: data
119
126
  });
@@ -129,7 +136,29 @@ function manifestFactory(_ref) {
129
136
  return client({
130
137
  url: "/manifests/" + manifestId + "/users/" + userId,
131
138
  method: "delete",
132
- headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
139
+ headers: authorizationHeaders({
140
+ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
141
+ })
142
+ });
143
+ }
144
+
145
+ function updateComment(_ref10) {
146
+ var token = _ref10.token,
147
+ jwtToken = _ref10.jwtToken,
148
+ manifestId = _ref10.manifestId,
149
+ _ref10$query = _ref10.query,
150
+ query = _ref10$query === undefined ? {} : _ref10$query,
151
+ data = _ref10.data,
152
+ headers = _ref10.headers;
153
+
154
+ return client({
155
+ url: "/manifests/" + manifestId + "/comments",
156
+ method: "put",
157
+ headers: authorizationHeaders({
158
+ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
159
+ }),
160
+ params: query,
161
+ data: data
133
162
  });
134
163
  }
135
164
 
@@ -141,7 +170,8 @@ function manifestFactory(_ref) {
141
170
  patch: patch,
142
171
  save: save,
143
172
  addUser: addUser,
144
- removeUser: removeUser
173
+ removeUser: removeUser,
174
+ updateComment: updateComment
145
175
  };
146
176
  }
147
177
 
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ var _require = require("./client.js"),
4
+ createApiClient = _require.createApiClient;
5
+
6
+ module.exports = createApiClient();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btrz-api-client",
3
- "version": "3.40.1",
3
+ "version": "3.42.3",
4
4
  "description": "Api client for Betterez endpoints",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -9,9 +9,11 @@
9
9
  "test:integration": "mocha --recursive -r test-integration/ports.js test-integration/",
10
10
  "browserify": "browserify lib/client.js --standalone BtrzApiClient -p tinyify -o lib/client-standalone-min.js",
11
11
  "commit-transpile": "git add lib/ && (git diff-index --quiet HEAD || git commit -m \"transpiled src\")",
12
+ "commit-types": "git add types/ && (git diff-index --quiet HEAD || git commit -m \"generated types from src\")",
12
13
  "pretranspile": "rm -rf lib/",
14
+ "types": "npx -p typescript tsc src/**.js --declaration --allowJs --emitDeclarationOnly --outDir types",
13
15
  "transpile": "babel --presets es2015 -d lib/ src/",
14
- "preversion": "npm test && npm run transpile && npm run browserify && npm run commit-transpile",
16
+ "preversion": "npm test && npm run transpile && npm run browserify && npm run types && npm run commit-transpile && npm run commit-types",
15
17
  "postversion": "git push origin master && git push --tags",
16
18
  "version": "git tag $1"
17
19
  },
package/src/client.js CHANGED
@@ -333,7 +333,6 @@ function createGPS({baseURL, headers, timeout, overrideFn, internalAuthTokenProv
333
333
  * returns an authorization token that's valid for making service-to-service API calls.
334
334
  * @param {Function} options.internalAuthTokenProvider.getToken
335
335
  * @param {{httpAgent: import("http").Agent, httpsAgent: import("https").Agent}} options.agents - An object containg one or both http agents
336
- * @returns {Object} An object with a client for every "module" (needed to override baseURL)
337
336
  */
338
337
  function createApiClient(options) {
339
338
  const {baseURL, baseURLOverride = {}, headers, timeout = 0, internalAuthTokenProvider, agents} = options || productionOptions;
@@ -1,7 +1,10 @@
1
- const { authorizationHeaders } = require("./../endpoints_helpers");
2
-
3
- function manifestFactory({ client, internalAuthTokenProvider }) {
1
+ const {
2
+ authorizationHeaders
3
+ } = require("./../endpoints_helpers.js");
4
4
 
5
+ function manifestFactory({
6
+ client, internalAuthTokenProvider
7
+ }) {
5
8
  function get({token, jwtToken, query = {}, headers}) {
6
9
  return client({
7
10
  url: "/manifests",
@@ -11,11 +14,15 @@ function manifestFactory({ client, internalAuthTokenProvider }) {
11
14
  });
12
15
  }
13
16
 
14
- function getById({ token, jwtToken, manifestId, headers }) {
17
+ function getById({
18
+ token, jwtToken, manifestId, headers
19
+ }) {
15
20
  return client({
16
21
  url: `/manifests/${manifestId}`,
17
22
  method: "get",
18
- headers: authorizationHeaders({ token, jwtToken, internalAuthTokenProvider, headers })
23
+ headers: authorizationHeaders({
24
+ token, jwtToken, internalAuthTokenProvider, headers
25
+ })
19
26
  });
20
27
  }
21
28
 
@@ -30,28 +37,38 @@ function manifestFactory({ client, internalAuthTokenProvider }) {
30
37
  });
31
38
  }
32
39
 
33
- function outlook({ token, jwtToken, query = {}, headers }) {
40
+ function outlook({
41
+ token, jwtToken, query = {}, headers
42
+ }) {
34
43
  return client({
35
44
  url: "/outlook-manifests",
36
45
  method: "get",
37
46
  params: query,
38
- headers: authorizationHeaders({ token, jwtToken, internalAuthTokenProvider, headers })
47
+ headers: authorizationHeaders({
48
+ token, jwtToken, internalAuthTokenProvider, headers
49
+ })
39
50
  });
40
51
  }
41
52
 
42
- function patch({ token, jwtToken, query = {}, operations, headers }) {
53
+ function patch({
54
+ token, jwtToken, query = {}, operations, headers
55
+ }) {
43
56
  return client({
44
57
  url: "/manifests",
45
58
  method: "patch",
46
59
  params: query,
47
60
  headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
48
- data: { operations }
61
+ data: {
62
+ operations
63
+ }
49
64
  });
50
65
  }
51
66
 
52
- function save({ token, jwtToken, providerId, data, headers }) {
67
+ function save({
68
+ token, jwtToken, providerId, data, headers
69
+ }) {
53
70
  return client({
54
- url: `/manifests`,
71
+ url: "/manifests",
55
72
  method: "put",
56
73
  params: {providerId, manifestId: data.manifestId},
57
74
  headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
@@ -59,21 +76,43 @@ function manifestFactory({ client, internalAuthTokenProvider }) {
59
76
  });
60
77
  }
61
78
 
62
- function addUser({ token, jwtToken, manifestId, query = {}, data, headers }) {
79
+ function addUser({
80
+ token, jwtToken, manifestId, query = {}, data, headers
81
+ }) {
63
82
  return client({
64
83
  url: `/manifests/${manifestId}/users`,
65
84
  method: "post",
66
- headers: authorizationHeaders({ token, jwtToken, internalAuthTokenProvider, headers }),
85
+ headers: authorizationHeaders({
86
+ token, jwtToken, internalAuthTokenProvider, headers
87
+ }),
67
88
  params: query,
68
89
  data
69
90
  });
70
91
  }
71
92
 
72
- function removeUser({ token, jwtToken, manifestId, userId, headers }) {
93
+ function removeUser({
94
+ token, jwtToken, manifestId, userId, headers
95
+ }) {
73
96
  return client({
74
97
  url: `/manifests/${manifestId}/users/${userId}`,
75
98
  method: "delete",
76
- headers: authorizationHeaders({ token, jwtToken, internalAuthTokenProvider, headers })
99
+ headers: authorizationHeaders({
100
+ token, jwtToken, internalAuthTokenProvider, headers
101
+ })
102
+ });
103
+ }
104
+
105
+ function updateComment({
106
+ token, jwtToken, manifestId, query = {}, data, headers
107
+ }) {
108
+ return client({
109
+ url: `/manifests/${manifestId}/comments`,
110
+ method: "put",
111
+ headers: authorizationHeaders({
112
+ token, jwtToken, internalAuthTokenProvider, headers
113
+ }),
114
+ params: query,
115
+ data
77
116
  });
78
117
  }
79
118
 
@@ -85,7 +124,8 @@ function manifestFactory({ client, internalAuthTokenProvider }) {
85
124
  patch,
86
125
  save,
87
126
  addUser,
88
- removeUser
127
+ removeUser,
128
+ updateComment
89
129
  };
90
130
  }
91
131
 
@@ -0,0 +1,3 @@
1
+ const {createApiClient} = require("./client.js");
2
+
3
+ module.exports = createApiClient();
@@ -1,11 +1,15 @@
1
1
  const {expect} = require("chai");
2
- const { axiosMock, expectRequest } = require("./../../test-helpers"),
3
- api = require("./../../../src/client").createApiClient({ baseURL: "http://test.com" });
2
+ const {
3
+ axiosMock, expectRequest
4
+ } = require("./../../test-helpers.js");
5
+ const api = require("./../../../src/client.js").createApiClient({
6
+ baseURL: "http://test.com"
7
+ });
4
8
 
5
9
  describe("operations/manifest", () => {
6
- const token = "I owe you a token",
7
- jwtToken = "I owe you a JWT token",
8
- providerId = "providerId";
10
+ const token = "I owe you a token";
11
+ const jwtToken = "I owe you a JWT token";
12
+ const providerId = "providerId";
9
13
 
10
14
  afterEach(() => {
11
15
  axiosMock.reset();
@@ -18,14 +22,22 @@ describe("operations/manifest", () => {
18
22
  scheduleId: "abc",
19
23
  date: "2017-10-10"
20
24
  };
21
- axiosMock.onGet("/manifests").reply(expectRequest({ statusCode: 200, token }));
22
- return api.operations.manifest.get({ token, jwtToken, query });
25
+ axiosMock.onGet("/manifests").reply(expectRequest({
26
+ statusCode: 200, token
27
+ }));
28
+ return api.operations.manifest.get({
29
+ token, jwtToken, query
30
+ });
23
31
  });
24
32
 
25
33
  it("should get a manifest by manifestId", () => {
26
34
  const manifestId = "manifestId";
27
- axiosMock.onGet(`/manifests/${manifestId}`).reply(expectRequest({ statusCode: 200, token }));
28
- return api.operations.manifest.getById({ token, jwtToken, manifestId });
35
+ axiosMock.onGet(`/manifests/${manifestId}`).reply(expectRequest({
36
+ statusCode: 200, token
37
+ }));
38
+ return api.operations.manifest.getById({
39
+ token, jwtToken, manifestId
40
+ });
29
41
  });
30
42
 
31
43
  it("should get many manifests", () => {
@@ -46,13 +58,21 @@ describe("operations/manifest", () => {
46
58
  productId: "productId",
47
59
  date: "2018-01-01"
48
60
  };
49
- axiosMock.onGet("/outlook-manifests").reply(expectRequest({ statusCode: 200, token, jwtToken }));
50
- return api.operations.manifest.outlook({ token, jwtToken, query });
61
+ axiosMock.onGet("/outlook-manifests").reply(expectRequest({
62
+ statusCode: 200, token, jwtToken
63
+ }));
64
+ return api.operations.manifest.outlook({
65
+ token, jwtToken, query
66
+ });
51
67
  });
52
68
 
53
69
  it("should patch a manifest", () => {
54
- axiosMock.onPatch("/manifests").reply(expectRequest({ statusCode: 200, token, jwtToken }));
55
- return api.operations.manifest.patch({ token, jwtToken, query: {providerId}, operations: {op: "add_tickets", tickets: []} });
70
+ axiosMock.onPatch("/manifests").reply(expectRequest({
71
+ statusCode: 200, token, jwtToken
72
+ }));
73
+ return api.operations.manifest.patch({
74
+ token, jwtToken, query: {providerId}, operations: {op: "add_tickets", tickets: []}
75
+ });
56
76
  });
57
77
 
58
78
  it("should save a manifest", () => {
@@ -61,8 +81,33 @@ describe("operations/manifest", () => {
61
81
  comments: "This is a comment!",
62
82
  capacity: 22
63
83
  };
64
- axiosMock.onPut("/manifests").reply(expectRequest({ statusCode: 200, token, jwtToken }));
65
- return api.operations.manifest.save({ token, jwtToken, providerId, data });
84
+ axiosMock.onPut("/manifests").reply(expectRequest({
85
+ statusCode: 200, token, jwtToken
86
+ }));
87
+ return api.operations.manifest.save({
88
+ token, jwtToken, providerId, data
89
+ });
90
+ });
91
+
92
+ it("should add comment to the manifest", async () => {
93
+ const manifestId = "theId";
94
+ const data = {
95
+ comment: {
96
+ test: "The comment"
97
+ }
98
+ };
99
+
100
+ // optional query
101
+ const query = {
102
+ accountId: providerId,
103
+ routeId: "2349283409238429348",
104
+ scheduleId: "abc",
105
+ date: "2017-10-10"
106
+ };
107
+ axiosMock.onPut(`/manifests/${manifestId}/comments`).reply(expectRequest({statusCode: 201, token, jwtToken}));
108
+ const call = await api.operations.manifest.updateComment({token, jwtToken, manifestId, data, query});
109
+ expect(call.config.params).to.be.eql(query);
110
+ return call;
66
111
  });
67
112
 
68
113
  it("should add user to the manifest", async () => {
@@ -90,7 +135,11 @@ describe("operations/manifest", () => {
90
135
  const manifestId = "theId";
91
136
  const userId = "theUserId";
92
137
 
93
- axiosMock.onDelete(`/manifests/${manifestId}/users/${userId}`).reply(expectRequest({ statusCode: 201, token, jwtToken }));
94
- return api.operations.manifest.removeUser({ token, jwtToken, manifestId, userId });
138
+ axiosMock.onDelete(`/manifests/${manifestId}/users/${userId}`).reply(expectRequest({
139
+ statusCode: 201, token, jwtToken
140
+ }));
141
+ return api.operations.manifest.removeUser({
142
+ token, jwtToken, manifestId, userId
143
+ });
95
144
  });
96
145
  });