ti2 1.0.114 → 1.0.115
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.
|
@@ -106,10 +106,10 @@ describe('user: bookings controller', () => {
|
|
|
106
106
|
token: userToken,
|
|
107
107
|
payload,
|
|
108
108
|
});
|
|
109
|
-
expect(plugins[0].
|
|
109
|
+
expect(plugins[0].searchItineraries).toHaveBeenCalled();
|
|
110
110
|
expect(Array.isArray(bookings)).toBeTruthy();
|
|
111
|
-
expect(plugins[0].
|
|
112
|
-
expect(plugins[0].
|
|
111
|
+
expect(plugins[0].searchItineraries.mock.calls[0][0].payload).toEqual(payload);
|
|
112
|
+
expect(plugins[0].searchItineraries.mock.calls[0][0].token).toEqual(token);
|
|
113
113
|
});
|
|
114
114
|
|
|
115
115
|
});
|
|
@@ -222,6 +222,19 @@ describe('user', () => {
|
|
|
222
222
|
expect(plugins[0].validateToken.mock.calls[0][0].payload).toEqual({
|
|
223
223
|
tokenHint: apiKey.split('-')[0],
|
|
224
224
|
});
|
|
225
|
+
expect(plugins[0].validateToken.mock.calls[0][0].userId).toBe(userId);
|
|
226
|
+
expect(plugins[0].validateToken.mock.calls[0][0].hint).toBe(apiKey.split('-')[0]);
|
|
227
|
+
});
|
|
228
|
+
it('testing the user token should not infer a hint when no hint is provided', async () => {
|
|
229
|
+
const { valid } = await doApiPost({
|
|
230
|
+
url: `/${appName}/${userId}/validate`,
|
|
231
|
+
token: userKey,
|
|
232
|
+
payload: {},
|
|
233
|
+
});
|
|
234
|
+
expect(plugins[0].validateToken).toHaveBeenCalled();
|
|
235
|
+
expect(valid).toBe(true);
|
|
236
|
+
expect(plugins[0].validateToken.mock.calls[0][0].userId).toBe(userId);
|
|
237
|
+
expect(plugins[0].validateToken.mock.calls[0][0].hint).toBeUndefined();
|
|
225
238
|
});
|
|
226
239
|
it('should be able to delete an app settings', async () => {
|
|
227
240
|
const returnValue = await doApiDelete({
|
package/controllers/app.js
CHANGED
package/controllers/bookings.js
CHANGED
|
@@ -52,7 +52,8 @@ const bookingsSearch = plugins => async (req, res, next) => {
|
|
|
52
52
|
try {
|
|
53
53
|
const { app, token } = await getAppAndToken({ plugins, appKey, userId, hint });
|
|
54
54
|
assert(app.searchItineraries || app.searchHotelBooking || app.searchBooking, `searchItineraries or searchHotelBooking or searchBooking is not available for ${appKey}`);
|
|
55
|
-
|
|
55
|
+
// Prefer the dedicated itinerary endpoint so date/filter payloads used by mining are preserved.
|
|
56
|
+
const search = (app.searchItineraries || app.searchHotelBooking || app.searchBooking).bind(app);
|
|
56
57
|
const results = await search({
|
|
57
58
|
axios,
|
|
58
59
|
token,
|