ti2-ventrata 1.0.24 → 1.0.26
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/index.js +5 -2
- package/index.test.js +11 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -37,8 +37,9 @@ const getHeaders = ({
|
|
|
37
37
|
|
|
38
38
|
const axiosSafeRequest = R.pick(['headers', 'method', 'url', 'data']);
|
|
39
39
|
const axiosSafeResponse = response => {
|
|
40
|
-
const retVal = R.pick(['data', 'status', 'statusText', 'headers', 'request'], response);
|
|
40
|
+
const retVal = R.pick(['data', 'status', 'statusText', 'headers', 'request', 'config'], response);
|
|
41
41
|
retVal.request = axiosSafeRequest(retVal.request);
|
|
42
|
+
retVal.config = axiosSafeRequest(retVal.config);
|
|
42
43
|
return retVal;
|
|
43
44
|
};
|
|
44
45
|
|
|
@@ -589,6 +590,7 @@ class Plugin {
|
|
|
589
590
|
pickupTypeDefs,
|
|
590
591
|
pickupQuery,
|
|
591
592
|
},
|
|
593
|
+
requestId,
|
|
592
594
|
}) {
|
|
593
595
|
const url = `${endpoint || this.endpoint}/products`;
|
|
594
596
|
const headers = getHeaders({
|
|
@@ -597,8 +599,9 @@ class Plugin {
|
|
|
597
599
|
octoEnv,
|
|
598
600
|
acceptLanguage,
|
|
599
601
|
resellerId,
|
|
602
|
+
requestId,
|
|
600
603
|
});
|
|
601
|
-
const products = R.pathOr([], ['data'], await axios({
|
|
604
|
+
const products = R.pathOr([], ['data'], await this.axios({
|
|
602
605
|
method: 'get',
|
|
603
606
|
url,
|
|
604
607
|
headers,
|
package/index.test.js
CHANGED
|
@@ -4,12 +4,12 @@ const moment = require('moment');
|
|
|
4
4
|
const faker = require('faker');
|
|
5
5
|
|
|
6
6
|
const Plugin = require('./index');
|
|
7
|
-
const fixtureUnits = require('./__fixtures__/units.js');
|
|
8
7
|
|
|
9
8
|
const { typeDefs: productTypeDefs, query: productQuery } = require('./node_modules/ti2/controllers/graphql-schemas/product');
|
|
10
9
|
const { typeDefs: availTypeDefs, query: availQuery } = require('./node_modules/ti2/controllers/graphql-schemas/availability');
|
|
11
10
|
const { typeDefs: bookingTypeDefs, query: bookingQuery } = require('./node_modules/ti2/controllers/graphql-schemas/booking');
|
|
12
11
|
const { typeDefs: rateTypeDefs, query: rateQuery } = require('./node_modules/ti2/controllers/graphql-schemas/rate');
|
|
12
|
+
const { typeDefs: pickupTypeDefs, query: pickupQuery } = require('./node_modules/ti2/controllers/graphql-schemas/pickup-point');
|
|
13
13
|
|
|
14
14
|
const typeDefsAndQueries = {
|
|
15
15
|
productTypeDefs,
|
|
@@ -20,6 +20,8 @@ const typeDefsAndQueries = {
|
|
|
20
20
|
bookingQuery,
|
|
21
21
|
rateTypeDefs,
|
|
22
22
|
rateQuery,
|
|
23
|
+
pickupQuery,
|
|
24
|
+
pickupTypeDefs,
|
|
23
25
|
};
|
|
24
26
|
|
|
25
27
|
const app = new Plugin({
|
|
@@ -306,5 +308,13 @@ describe('search tests', () => {
|
|
|
306
308
|
expect(R.path(['supplierBookingId'], booking)).toBeTruthy();
|
|
307
309
|
expect(R.path(['cancellable'], booking)).toBeTruthy();
|
|
308
310
|
});
|
|
311
|
+
it('should be able to get a list of pickuppoints', async () => {
|
|
312
|
+
const retVal = await app.getPickupPoints({
|
|
313
|
+
token,
|
|
314
|
+
typeDefsAndQueries,
|
|
315
|
+
});
|
|
316
|
+
expect(Array.isArray(retVal.pickupPoints)).toBeTruthy();
|
|
317
|
+
expect(R.path(['pickupPoints', 0, 'id'], retVal)).toBeTruthy();
|
|
318
|
+
});
|
|
309
319
|
});
|
|
310
320
|
});
|