mirror of
https://github.com/MadsLorentzen/ai-job-search.git
synced 2026-11-02 13:12:50 +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
@@ -128,11 +128,12 @@ describe("Jobnet search normalization", () => {
|
||||
expect("description" in output.results[0]).toBe(false);
|
||||
});
|
||||
|
||||
test("additively emits the /scrape contract fields (company, location, date, deadline, url)", () => {
|
||||
test("additively emits the /scrape contract fields (id, company, location, date, deadline, url)", () => {
|
||||
const output = createSearchOutput(apiResponse(), { ...flags, limit: undefined });
|
||||
|
||||
expect(output.results).toHaveLength(2);
|
||||
expect(output.results[0]).toMatchObject({
|
||||
id: "job-1",
|
||||
company: "Acme",
|
||||
location: null,
|
||||
date: "2026-07-01",
|
||||
@@ -140,6 +141,7 @@ describe("Jobnet search normalization", () => {
|
||||
url: "https://jobnet.dk/find-job/job-1",
|
||||
});
|
||||
expect(output.results[1]).toMatchObject({
|
||||
id: "job-2",
|
||||
company: "Example Co",
|
||||
location: "København Ø",
|
||||
date: "2026-07-02",
|
||||
@@ -148,6 +150,8 @@ describe("Jobnet search normalization", () => {
|
||||
});
|
||||
expect(output.results[0].hiringOrgName).toBe("Acme");
|
||||
expect(output.results[1].applicationDeadline).toBe("2026-08-01T23:59:00+02:00");
|
||||
// `id` is the contract name for the value `detail <jobAdId>` consumes.
|
||||
expect(output.results[0].id).toBe(output.results[0].jobAdId);
|
||||
});
|
||||
|
||||
test("maps Jobnet's undisclosed-deadline sentinel (1900-01-01) to null", () => {
|
||||
|
||||
Reference in new issue
Block a user