ti2-tourplan 1.0.133 → 1.0.134
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.test.js +44 -0
- package/package.json +1 -1
package/index.test.js
CHANGED
|
@@ -1850,6 +1850,50 @@ describe('search tests', () => {
|
|
|
1850
1850
|
}
|
|
1851
1851
|
});
|
|
1852
1852
|
|
|
1853
|
+
it('searchItineraries searches alphanumeric bookingId candidates as AgentRef', async () => {
|
|
1854
|
+
axios.mockImplementation(getFixture);
|
|
1855
|
+
mockCallTourplan.mockImplementation(async request => {
|
|
1856
|
+
const { model } = request;
|
|
1857
|
+
const listRequest = model && model.ListBookingsRequest;
|
|
1858
|
+
if (listRequest && listRequest.BookingId === 'SGMX269690') {
|
|
1859
|
+
return { ListBookingsReply: { BookingHeaders: { BookingHeader: [] } } };
|
|
1860
|
+
}
|
|
1861
|
+
if (listRequest && listRequest.Ref === 'SGMX269690') {
|
|
1862
|
+
return { ListBookingsReply: { BookingHeaders: { BookingHeader: [] } } };
|
|
1863
|
+
}
|
|
1864
|
+
if (listRequest && listRequest.AgentRef === 'SGMX269690') {
|
|
1865
|
+
return {
|
|
1866
|
+
ListBookingsReply: {
|
|
1867
|
+
BookingHeaders: {
|
|
1868
|
+
BookingHeader: [{ BookingId: '316559' }],
|
|
1869
|
+
},
|
|
1870
|
+
},
|
|
1871
|
+
};
|
|
1872
|
+
}
|
|
1873
|
+
return defaultCallTourplanImplementation(request);
|
|
1874
|
+
});
|
|
1875
|
+
|
|
1876
|
+
const retVal = await app.searchItineraries({
|
|
1877
|
+
axios,
|
|
1878
|
+
token,
|
|
1879
|
+
typeDefsAndQueries,
|
|
1880
|
+
payload: {
|
|
1881
|
+
bookingId: 'SGMX269690',
|
|
1882
|
+
},
|
|
1883
|
+
});
|
|
1884
|
+
|
|
1885
|
+
expect(retVal.bookings.length).toBe(1);
|
|
1886
|
+
expect(retVal.bookings[0].bookingId).toBe('316559');
|
|
1887
|
+
const listRequests = mockCallTourplan.mock.calls
|
|
1888
|
+
.map(([{ model }]) => model && model.ListBookingsRequest)
|
|
1889
|
+
.filter(Boolean);
|
|
1890
|
+
expect(listRequests).toEqual(expect.arrayContaining([
|
|
1891
|
+
expect.objectContaining({ BookingId: 'SGMX269690' }),
|
|
1892
|
+
expect.objectContaining({ Ref: 'SGMX269690' }),
|
|
1893
|
+
expect.objectContaining({ AgentRef: 'SGMX269690' }),
|
|
1894
|
+
]));
|
|
1895
|
+
});
|
|
1896
|
+
|
|
1853
1897
|
it('searchItineraries by name (NameContains)', async () => {
|
|
1854
1898
|
axios.mockImplementation(getFixture);
|
|
1855
1899
|
const retVal = await app.searchItineraries({
|