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
@@ -69,7 +69,7 @@ Key flags:
|
||||
bun run .agents/skills/jobnet-search/cli/src/cli.ts detail <jobAdId> [--format json|plain]
|
||||
```
|
||||
|
||||
`jobAdId` is the UUID from `search` results (the `jobAdId` field). Returns the complete job
|
||||
`jobAdId` is the UUID from `search` results (the `jobAdId` field, also emitted as `id`, the portal-contract name every search CLI shares). Returns the complete job
|
||||
description, contact persons, application deadline, employer details, and direct application URL.
|
||||
|
||||
### Search occupation types
|
||||
|
||||
@@ -104,6 +104,10 @@ export function createSearchOutput(data: SearchApiResponse, flags: SearchFlags)
|
||||
workPlaceAddress: job.workPlaceAddress ?? "",
|
||||
isSeen: job.isSeen,
|
||||
isFavorite: job.isFavorite,
|
||||
// /scrape contract aliases (add-portal.md: every result carries at least
|
||||
// id, title, company, location, date, url). `id` is the jobAdId - the
|
||||
// value `detail` takes - under the name every other portal CLI uses.
|
||||
id: job.jobAdId,
|
||||
company: job.hiringOrgName,
|
||||
location: job.postalDistrictName ?? job.municipality ?? null,
|
||||
date: job.publicationDate ? job.publicationDate.slice(0, 10) : null,
|
||||
|
||||
@@ -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