mirror of
https://github.com/MadsLorentzen/ai-job-search.git
synced 2026-11-08 16:07:40 +00:00
fix(portal-clis): emit the contract's id field from jobnet and jobdanmark search results (#518)
/add-portal's contract says every search result carries at least id, title, company, location, date, url, and the four other shipped CLIs emit id. When #340 added the company/location/date/url aliases to these two, id was left out: jobnet exposed the value only as jobAdId, jobdanmark only as slug, so a consumer reading every portal's JSON through one shape had to special-case both to call detail. Purely additive: id equals jobAdId on jobnet and slug on jobdanmark, the native keys stay, nothing is renamed. Each SKILL.md notes the alias. The additive-contract test in each CLI now asserts id and its equality with the native key; both fail on master.
This commit is contained in:
1 parent
e9115b02f8
commit
895c02191d
7 files changed
+30
-4
No files matched your search
@@ -20,16 +20,19 @@ function item(): ApiSearchItem {
|
||||
}
|
||||
|
||||
describe("Jobdanmark search normalization", () => {
|
||||
test("additively emits the /scrape contract fields (company, location, date, deadline)", () => {
|
||||
test("additively emits the /scrape contract fields (id, company, location, date, deadline, url)", () => {
|
||||
const result = normalizeItem(item());
|
||||
|
||||
expect(result).toMatchObject({
|
||||
id: "softwareudvikler-til-statens-it",
|
||||
company: "Statens It",
|
||||
location: "Ballerup",
|
||||
date: "2026-07-27",
|
||||
deadline: "2026-08-17",
|
||||
url: "https://jobdanmark.dk/job/softwareudvikler-til-statens-it",
|
||||
});
|
||||
// `id` is the contract name for the value `detail <slug>` consumes.
|
||||
expect(result.id).toBe(result.slug);
|
||||
});
|
||||
|
||||
test("maps a missing address zip and a null deadline to null", () => {
|
||||
|
||||
Reference in new issue
Block a user