From 66aba50b4977f97622a21c80ce5bc8ac39eb82a4 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sun, 29 Nov 2026 15:06:45 +0000 Subject: [PATCH 1/8] fix(skill): route flights for a city without an IATA code through airports-near PET-504: a places city row with a code that is not 3 letters (Makkah 8283) is not a flight endpoint. Co-Authored-By: ahsan.amin@wego.com --- skills/wego/references/cli.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skills/wego/references/cli.md b/skills/wego/references/cli.md index 993d091..62f4fe1 100644 --- a/skills/wego/references/cli.md +++ b/skills/wego/references/cli.md @@ -99,7 +99,7 @@ wego places "" [--types ] [--locale en `--types` narrows the candidates; omit it to resolve every place type (`city`, `airport`, `state`, `district`, `hotel`). Match the filter to the vertical – do not carry a flights-only filter into a hotel lookup. -- For flights, resolve each endpoint to an airport or city IATA code; narrow with `--types city,airport` when you want only those. Record whether the selected result is a `city` or `airport`; the booking-link command needs `--from-city` or `--to-city` when the original flight search used a city code. +- For flights, resolve each endpoint to an airport or city IATA code; narrow with `--types city,airport` when you want only those. Record whether the selected result is a `city` or `airport`; the booking-link command needs `--from-city` or `--to-city` when the original flight search used a city code. **A city whose `code` is not 3 uppercase letters (Makkah `8283`) has no airport of its own, so it is not a flight endpoint.** Run `wego info airports-near ,` with that city row's coordinates, and search the airport codes it returns (for Makkah, `JED` and `TIF`). Read each row's `name` first, because some rows are train stations (`MKX` is Makkah Train Station). Tell the user which airport you chose and how far it is from the city. - For hotels, pass an uppercase three-letter city code, a numeric hotel ID, or `lat,lng`. Leave `--types` off (or pass `city,district,hotel`) so hotel, district, and landmark candidates are not filtered out. Use coordinates for a district, landmark, or nearby search when no suitable city code or hotel ID represents the request. - If `metadata.hasAmbiguity` is true, use `disambiguationHint` and the candidates to clarify before proceeding. - Reuse resolved values during the same conversation instead of resolving them repeatedly. From 7ca7bc738de067b1d95d856c853e3a03867b09a0 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sun, 29 Nov 2026 15:08:58 +0000 Subject: [PATCH 2/8] fix(skill): search one nearby airport for a city without an IATA code Co-Authored-By: ahsan.amin@wego.com --- skills/wego/references/cli.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skills/wego/references/cli.md b/skills/wego/references/cli.md index 62f4fe1..22c9575 100644 --- a/skills/wego/references/cli.md +++ b/skills/wego/references/cli.md @@ -99,7 +99,7 @@ wego places "" [--types ] [--locale en `--types` narrows the candidates; omit it to resolve every place type (`city`, `airport`, `state`, `district`, `hotel`). Match the filter to the vertical – do not carry a flights-only filter into a hotel lookup. -- For flights, resolve each endpoint to an airport or city IATA code; narrow with `--types city,airport` when you want only those. Record whether the selected result is a `city` or `airport`; the booking-link command needs `--from-city` or `--to-city` when the original flight search used a city code. **A city whose `code` is not 3 uppercase letters (Makkah `8283`) has no airport of its own, so it is not a flight endpoint.** Run `wego info airports-near ,` with that city row's coordinates, and search the airport codes it returns (for Makkah, `JED` and `TIF`). Read each row's `name` first, because some rows are train stations (`MKX` is Makkah Train Station). Tell the user which airport you chose and how far it is from the city. +- For flights, resolve each endpoint to an airport or city IATA code; narrow with `--types city,airport` when you want only those. Record whether the selected result is a `city` or `airport`; the booking-link command needs `--from-city` or `--to-city` when the original flight search used a city code. **A city whose `code` is not 3 uppercase letters (Makkah `8283`) has no airport of its own, so it is not a flight endpoint.** Run `wego info airports-near ,` with that city row's coordinates, and pick the nearest airport it returns (for Makkah, `JED`). Read each row's `name` first, because some rows are train stations (`MKX` is Makkah Train Station). Search that one airport, and tell the user which airport you chose and how far it is from the city. Search another returned airport (`TIF`) only when the user asks to compare. - For hotels, pass an uppercase three-letter city code, a numeric hotel ID, or `lat,lng`. Leave `--types` off (or pass `city,district,hotel`) so hotel, district, and landmark candidates are not filtered out. Use coordinates for a district, landmark, or nearby search when no suitable city code or hotel ID represents the request. - If `metadata.hasAmbiguity` is true, use `disambiguationHint` and the candidates to clarify before proceeding. - Reuse resolved values during the same conversation instead of resolving them repeatedly. From 747c53f716ebea752d199d9a3f63f5a454d2286d Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sun, 29 Nov 2026 15:10:46 +0000 Subject: [PATCH 3/8] fix(skill): skip a nearby airport the user ruled out Co-Authored-By: ahsan.amin@wego.com --- skills/wego/references/cli.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skills/wego/references/cli.md b/skills/wego/references/cli.md index 22c9575..bb6dd0a 100644 --- a/skills/wego/references/cli.md +++ b/skills/wego/references/cli.md @@ -99,7 +99,7 @@ wego places "" [--types ] [--locale en `--types` narrows the candidates; omit it to resolve every place type (`city`, `airport`, `state`, `district`, `hotel`). Match the filter to the vertical – do not carry a flights-only filter into a hotel lookup. -- For flights, resolve each endpoint to an airport or city IATA code; narrow with `--types city,airport` when you want only those. Record whether the selected result is a `city` or `airport`; the booking-link command needs `--from-city` or `--to-city` when the original flight search used a city code. **A city whose `code` is not 3 uppercase letters (Makkah `8283`) has no airport of its own, so it is not a flight endpoint.** Run `wego info airports-near ,` with that city row's coordinates, and pick the nearest airport it returns (for Makkah, `JED`). Read each row's `name` first, because some rows are train stations (`MKX` is Makkah Train Station). Search that one airport, and tell the user which airport you chose and how far it is from the city. Search another returned airport (`TIF`) only when the user asks to compare. +- For flights, resolve each endpoint to an airport or city IATA code; narrow with `--types city,airport` when you want only those. Record whether the selected result is a `city` or `airport`; the booking-link command needs `--from-city` or `--to-city` when the original flight search used a city code. **A city whose `code` is not 3 uppercase letters (Makkah `8283`) has no airport of its own, so it is not a flight endpoint.** Run `wego info airports-near ,` with that city row's coordinates, and pick the nearest airport it returns that the user did not rule out (for Makkah, `JED`, or `TIF` if the user rules out Jeddah). Read each row's `name` first, because some rows are train stations (`MKX` is Makkah Train Station). Search that one airport, and tell the user which airport you chose and how far it is from the city. Search a second airport only when the user asks to compare. - For hotels, pass an uppercase three-letter city code, a numeric hotel ID, or `lat,lng`. Leave `--types` off (or pass `city,district,hotel`) so hotel, district, and landmark candidates are not filtered out. Use coordinates for a district, landmark, or nearby search when no suitable city code or hotel ID represents the request. - If `metadata.hasAmbiguity` is true, use `disambiguationHint` and the candidates to clarify before proceeding. - Reuse resolved values during the same conversation instead of resolving them repeatedly. From decf3b1863ef2450e637626e2a909cf56af76bf3 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sun, 29 Nov 2026 15:11:42 +0000 Subject: [PATCH 4/8] fix(skill): give the airport distance only when the row has coordinates Co-Authored-By: ahsan.amin@wego.com --- skills/wego/references/cli.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skills/wego/references/cli.md b/skills/wego/references/cli.md index bb6dd0a..4ac132b 100644 --- a/skills/wego/references/cli.md +++ b/skills/wego/references/cli.md @@ -99,7 +99,7 @@ wego places "" [--types ] [--locale en `--types` narrows the candidates; omit it to resolve every place type (`city`, `airport`, `state`, `district`, `hotel`). Match the filter to the vertical – do not carry a flights-only filter into a hotel lookup. -- For flights, resolve each endpoint to an airport or city IATA code; narrow with `--types city,airport` when you want only those. Record whether the selected result is a `city` or `airport`; the booking-link command needs `--from-city` or `--to-city` when the original flight search used a city code. **A city whose `code` is not 3 uppercase letters (Makkah `8283`) has no airport of its own, so it is not a flight endpoint.** Run `wego info airports-near ,` with that city row's coordinates, and pick the nearest airport it returns that the user did not rule out (for Makkah, `JED`, or `TIF` if the user rules out Jeddah). Read each row's `name` first, because some rows are train stations (`MKX` is Makkah Train Station). Search that one airport, and tell the user which airport you chose and how far it is from the city. Search a second airport only when the user asks to compare. +- For flights, resolve each endpoint to an airport or city IATA code; narrow with `--types city,airport` when you want only those. Record whether the selected result is a `city` or `airport`; the booking-link command needs `--from-city` or `--to-city` when the original flight search used a city code. **A city whose `code` is not 3 uppercase letters (Makkah `8283`) has no airport of its own, so it is not a flight endpoint.** Run `wego info airports-near ,` with that city row's coordinates, and pick the nearest airport it returns that the user did not rule out (for Makkah, `JED`, or `TIF` if the user rules out Jeddah). Read each row's `name` first, because some rows are train stations (`MKX` is Makkah Train Station). Search that one airport, and tell the user which airport you chose. Give its distance from the city only when the row has `latitude` and `longitude` to compute it from, and otherwise say the distance is unknown. Search a second airport only when the user asks to compare. - For hotels, pass an uppercase three-letter city code, a numeric hotel ID, or `lat,lng`. Leave `--types` off (or pass `city,district,hotel`) so hotel, district, and landmark candidates are not filtered out. Use coordinates for a district, landmark, or nearby search when no suitable city code or hotel ID represents the request. - If `metadata.hasAmbiguity` is true, use `disambiguationHint` and the candidates to clarify before proceeding. - Reuse resolved values during the same conversation instead of resolving them repeatedly. From da95f81b3885f02b2243ead955ff2e4a3dac8ddf Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sun, 29 Nov 2026 15:25:38 +0000 Subject: [PATCH 5/8] chore(contract): accept a numeric cityCode on the hotels search link Mirrors the search-link cityCode of wego/wego-ai#2134 (API 0.19.4) ahead of its deploy. bun run api-contract:refresh replaces it once the API ships. Co-Authored-By: ahsan.amin@wego.com --- contract/openapi.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/contract/openapi.json b/contract/openapi.json index c5b8260..960431b 100644 --- a/contract/openapi.json +++ b/contract/openapi.json @@ -6271,11 +6271,10 @@ "name": "cityCode", "schema": { "type": "string", - "pattern": "^[A-Z]{3}$", "example": "BKK" }, "required": true, - "description": "City code the link searches, e.g. BKK. Take it from a places result's code or cityCode, never its numeric id. A lat/lng pair cannot be shared: wego.com serves no coordinate search URL. To link one hotel instead of a search, use the pageUrl that hotel carries." + "description": "City code the link searches: a 3-letter code (BKK), or the numeric code a city without an airport carries (Makkah is 8283, Cannes is 1293-74). Take it from a places result's code or cityCode, never its numeric id. A lat/lng pair cannot be shared: wego.com serves no coordinate search URL. To link one hotel instead of a search, use the pageUrl that hotel carries." }, { "in": "query", From a47ad33cc80f649e3ecbbd1c5189c13a6dc6d96a Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sun, 29 Nov 2026 15:25:42 +0000 Subject: [PATCH 6/8] fix(hotels): share a city without an IATA code by its numeric code hotels share accepts 8283 (Makkah) and 1293-74 (Cannes), which wego.com opens like a 3-letter city code, and the refusal points at places --types city. A hotelId is numeric too, so it is no longer refused by shape; the skill says to pass only a places code. (PET-504) Co-Authored-By: ahsan.amin@wego.com --- integration/hotels.test.ts | 13 ++++++++----- skills/wego/references/cli.md | 4 ++-- src/commands.ts | 4 ++-- src/hotels.test.ts | 20 +++++++++++++++++++- 4 files changed, 31 insertions(+), 10 deletions(-) diff --git a/integration/hotels.test.ts b/integration/hotels.test.ts index 0e6de2c..b736445 100644 --- a/integration/hotels.test.ts +++ b/integration/hotels.test.ts @@ -390,11 +390,6 @@ describe("hotels usage errors: exit 2, no request", () => { ["hotels", "share", "BKK", ...DATES, "--rooms", "two"], "--rooms", ], - [ - "share: a hotelId, naming the city code as the way through", - ["hotels", "share", "710862", ...DATES], - "city code", - ], [ "share: lat,lng", ["hotels", "share", "13.75,100.5", ...DATES], @@ -1263,6 +1258,14 @@ describe("hotels share", () => { ); }); + it("shares a city without an airport by its numeric code", async () => { + signIn(s.home); + const fake = s.fake({ routes: [route("hotels-search-link")] }); + const result = await s.run(["hotels", "share", "8283", ...DATES]); + expect(result.code).toBe(0); + expect(query(fake, "getHotelSearchLink").cityCode).toBe("8283"); + }); + it("sends --rooms, the same occupancy vocabulary as hotels search", async () => { signIn(s.home); const fake = s.fake({ routes: [route("hotels-search-link")] }); diff --git a/skills/wego/references/cli.md b/skills/wego/references/cli.md index 4ac132b..304fb7e 100644 --- a/skills/wego/references/cli.md +++ b/skills/wego/references/cli.md @@ -520,9 +520,9 @@ wego hotels share \ No prior search needed. Pass the same `--site`, `--currency` and `--locale` the search used, so the recipient opens it in the same market; the link runs live, so they see current prices, not this conversation's. -**Never hand-build a wego.com hotels URL, and never put a `places` `id` in one.** Only a `code` addresses a city there; a numeric id silently loads a different country. This command is the only supported way to make a hotel link that keeps working. +**Never hand-build a wego.com hotels URL, and never put a `places` `id` or a hotelId in one.** A hotelId is numeric like a city code, so `hotels share` cannot refuse it, and the link opens whichever city has that code. Pass only a `code` from `wego places "" --types city`. Only a `code` addresses a city there; a numeric id silently loads a different country. This command is the only supported way to make a hotel link that keeps working. -It refuses what a search URL cannot carry, each an exit 2 before any call: anything that is not an uppercase 3-letter city code, **a hotelId, a coordinate or a city name** (share the city instead and name the hotel in your message, taking the code from `wego places "" --types city`), and **`--children` above 0 without `--children-ages`** (elsewhere a missing age is priced at 8; here that guess reaches someone who cannot correct it). +It refuses what a search URL cannot carry, each an exit 2 before any call: anything that is not a city code (3 uppercase letters, or the numeric code a city without an airport carries, Makkah `8283`), **a coordinate or a city name** (share the city instead and name the hotel in your message, taking the code from `wego places "" --types city`), and **`--children` above 0 without `--children-ages`** (elsewhere a missing age is priced at 8; here that guess reaches someone who cannot correct it). Pass `--rooms N` for a stay that needs more than one room, the same flag `hotels search` takes. Rooms are 1-4 and never more than `--adults`, which defaults to 2, so send `--adults` alongside any `--rooms` above 2 or the link is refused. The guests spread evenly with the earlier rooms filled first, so the link opens the same occupancy the search priced. diff --git a/src/commands.ts b/src/commands.ts index bd9f2bc..c891292 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -2247,9 +2247,9 @@ export function parseHotelsShareArgs( throw new Error(`Unexpected argument: ${extra[0]}\n${HOTELS_SHARE_USAGE}`); } // Not `locationFields`: its message names hotelId and lat,lng, the two shapes this command refuses. - if (!/^[A-Z]{3}$/.test(location)) { + if (!/^([A-Z]{3}|\d{1,9}(-\d{1,9})?)$/.test(location)) { throw new Error( - `A durable link needs a city, so "${location}" cannot be shared: wego.com serves no hotel-level or coordinate search URL. Pass an uppercase 3-letter city code, which \`${PROG} places --types city\` reports as code.`, + `A durable link needs a city, so "${location}" cannot be shared: wego.com serves no hotel-level or coordinate search URL. Pass a city code from \`${PROG} places --types city\`: 3 uppercase letters (BKK), or the numeric code a city without an airport carries (Makkah is 8283).`, ); } const query: WireQueryValues<"getHotelSearchLink"> = { diff --git a/src/hotels.test.ts b/src/hotels.test.ts index 9a81381..93442cc 100644 --- a/src/hotels.test.ts +++ b/src/hotels.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "bun:test"; -import { parseRoomsArgs, settleRates } from "./commands"; +import { parseHotelsShareArgs, parseRoomsArgs, settleRates } from "./commands"; import { HOTELS } from "./verticals"; /** @@ -191,3 +191,21 @@ describe("HOTELS empty-page note", () => { ).toBeUndefined(); }); }); + +describe("parseHotelsShareArgs", () => { + const DATES = ["2027-01-20", "2027-01-22"]; + + it("accepts a 3-letter code and the numeric code of a city without an airport", () => { + for (const code of ["BKK", "8283", "1293-74"]) { + expect(parseHotelsShareArgs([code, ...DATES]).cityCode).toBe(code); + } + }); + + it("refuses a code a search URL cannot carry, pointing at places --types city", () => { + for (const code of ["bkk", "Makkah", "21.42,39.82", "8283x", "1293-"]) { + expect(() => parseHotelsShareArgs([code, ...DATES])).toThrow( + /city code from `.+ places --types city`: 3 uppercase letters \(BKK\), or the numeric code/, + ); + } + }); +}); From 97e90e2249eb2ddb060a853a531ef3889e22fd18 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sun, 29 Nov 2026 15:36:53 +0000 Subject: [PATCH 7/8] fix(skill): say share checks the code shape and handle a city row without coordinates airports-near refuses a numeric code, so a city row with no latitude and longitude ends with a question to the user. (PET-504) Co-Authored-By: ahsan.amin@wego.com --- skills/wego/references/cli.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/skills/wego/references/cli.md b/skills/wego/references/cli.md index 304fb7e..2e3dac0 100644 --- a/skills/wego/references/cli.md +++ b/skills/wego/references/cli.md @@ -99,7 +99,7 @@ wego places "" [--types ] [--locale en `--types` narrows the candidates; omit it to resolve every place type (`city`, `airport`, `state`, `district`, `hotel`). Match the filter to the vertical – do not carry a flights-only filter into a hotel lookup. -- For flights, resolve each endpoint to an airport or city IATA code; narrow with `--types city,airport` when you want only those. Record whether the selected result is a `city` or `airport`; the booking-link command needs `--from-city` or `--to-city` when the original flight search used a city code. **A city whose `code` is not 3 uppercase letters (Makkah `8283`) has no airport of its own, so it is not a flight endpoint.** Run `wego info airports-near ,` with that city row's coordinates, and pick the nearest airport it returns that the user did not rule out (for Makkah, `JED`, or `TIF` if the user rules out Jeddah). Read each row's `name` first, because some rows are train stations (`MKX` is Makkah Train Station). Search that one airport, and tell the user which airport you chose. Give its distance from the city only when the row has `latitude` and `longitude` to compute it from, and otherwise say the distance is unknown. Search a second airport only when the user asks to compare. +- For flights, resolve each endpoint to an airport or city IATA code; narrow with `--types city,airport` when you want only those. Record whether the selected result is a `city` or `airport`; the booking-link command needs `--from-city` or `--to-city` when the original flight search used a city code. **A city whose `code` is not 3 uppercase letters (Makkah `8283`) has no airport of its own, so it is not a flight endpoint.** Run `wego info airports-near ,` with that city row's coordinates. If the row has no `latitude` and `longitude`, do not pass the numeric code instead, because `airports-near` refuses it: tell the user the nearby airports cannot be found from that row, and ask which airport they want. Otherwise pick the nearest airport it returns that the user did not rule out (for Makkah, `JED`, or `TIF` if the user rules out Jeddah). Read each row's `name` first, because some rows are train stations (`MKX` is Makkah Train Station). Search that one airport, and tell the user which airport you chose. Give its distance from the city only when the row has `latitude` and `longitude` to compute it from, and otherwise say the distance is unknown. Search a second airport only when the user asks to compare. - For hotels, pass an uppercase three-letter city code, a numeric hotel ID, or `lat,lng`. Leave `--types` off (or pass `city,district,hotel`) so hotel, district, and landmark candidates are not filtered out. Use coordinates for a district, landmark, or nearby search when no suitable city code or hotel ID represents the request. - If `metadata.hasAmbiguity` is true, use `disambiguationHint` and the candidates to clarify before proceeding. - Reuse resolved values during the same conversation instead of resolving them repeatedly. @@ -522,7 +522,7 @@ No prior search needed. Pass the same `--site`, `--currency` and `--locale` the **Never hand-build a wego.com hotels URL, and never put a `places` `id` or a hotelId in one.** A hotelId is numeric like a city code, so `hotels share` cannot refuse it, and the link opens whichever city has that code. Pass only a `code` from `wego places "" --types city`. Only a `code` addresses a city there; a numeric id silently loads a different country. This command is the only supported way to make a hotel link that keeps working. -It refuses what a search URL cannot carry, each an exit 2 before any call: anything that is not a city code (3 uppercase letters, or the numeric code a city without an airport carries, Makkah `8283`), **a coordinate or a city name** (share the city instead and name the hotel in your message, taking the code from `wego places "" --types city`), and **`--children` above 0 without `--children-ages`** (elsewhere a missing age is priced at 8; here that guess reaches someone who cannot correct it). +It refuses what a search URL cannot carry, each an exit 2 before any call: anything that does not have the shape of a city code (3 uppercase letters, or digits like the code a city without an airport carries, Makkah `8283`), **a coordinate or a city name**. It checks the shape only, not that the code names a city, so take the code from `wego places "" --types city` (share the city instead and name the hotel in your message, taking the code from `wego places "" --types city`), and **`--children` above 0 without `--children-ages`** (elsewhere a missing age is priced at 8; here that guess reaches someone who cannot correct it). Pass `--rooms N` for a stay that needs more than one room, the same flag `hotels search` takes. Rooms are 1-4 and never more than `--adults`, which defaults to 2, so send `--adults` alongside any `--rooms` above 2 or the link is refused. The guests spread evenly with the earlier rooms filled first, so the link opens the same occupancy the search priced. From 9244bae1e09f8146588fa35febff3e1a3ca545de Mon Sep 17 00:00:00 2001 From: Ahsan Amin Date: Sat, 5 Dec 2026 00:42:01 +0500 Subject: [PATCH 8/8] test(hotels): cover hotels search 8283 with a Makkah Places fixture (PET-504) Makkah's Places id (16907) differs from its code (8283), so the fixture proves the search sends the code as cityCode and never the id. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FN4HWBtNpYAJX9DryXpfVr --- integration/fixtures/places-makkah.json | 23 +++++++++++++++++++++++ integration/hotels.test.ts | 19 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 integration/fixtures/places-makkah.json diff --git a/integration/fixtures/places-makkah.json b/integration/fixtures/places-makkah.json new file mode 100644 index 0000000..da409e5 --- /dev/null +++ b/integration/fixtures/places-makkah.json @@ -0,0 +1,23 @@ +{ + "op": "getPlaces", + "status": 200, + "body": { + "results": [ + { + "id": 16907, + "code": "8283", + "name": "Makkah", + "type": "city", + "cityCode": "8283", + "latitude": 21.3891, + "longitude": 39.8579 + } + ], + "metadata": { + "resultCount": 1, + "totalCandidates": 1, + "hasMore": false, + "hasAmbiguity": false + } + } +} diff --git a/integration/hotels.test.ts b/integration/hotels.test.ts index 40d00c1..48da8b7 100644 --- a/integration/hotels.test.ts +++ b/integration/hotels.test.ts @@ -452,6 +452,25 @@ describe("hotels search", () => { expect(createBody(fake)).not.toHaveProperty("hotelId"); }); + // Makkah as Places returns it: its id (16907) differs from its code. + it("searches Makkah by its code 8283, never its Places id", async () => { + signIn(s.home); + const fake = s.fake({ + routes: [ + route("places-makkah"), + route("hotels-search-create"), + route("hotels-search-results"), + ], + }); + const result = await s.run(["hotels", "search", "8283", ...DATES]); + + expect(result.code).toBe(0); + expect(fake.requests("getPlaces")[0]?.query.get("query")).toBe("8283"); + expect(createBody(fake)).toMatchObject({ cityCode: "8283" }); + expect(createBody(fake)).not.toHaveProperty("hotelId"); + expect(JSON.stringify(createBody(fake))).not.toContain("16907"); + }); + it("keeps an all-digit location that Places lists as no city a hotelId", async () => { signIn(s.home); const fake = s.fake({