mirror of
https://github.com/MadsLorentzen/ai-job-search.git
synced 2026-09-17 08:36:25 +00:00
feat(linkedin-search): add --jobage-minutes for sub-day freshness windows (#302)
jobageToTPR() only emits whole-day f_TPR windows, so a search can't be restricted to postings from the last N minutes. LinkedIn's f_TPR filters server-side down to one-second granularity (confirmed empirically), so this is a pure window-construction change via a new minutesToTPR() helper - no HTML parsing changes needed. --jobage-minutes and --jobage both express a freshness window; passing both is rejected with CONFLICTING_AGE_FLAGS rather than one silently overriding the other.
This commit is contained in:
@@ -39,4 +39,23 @@ describe("runSearch", () => {
|
||||
expect(code).toBe(0);
|
||||
expect(JSON.parse(stdout).results).toHaveLength(0);
|
||||
});
|
||||
|
||||
test("--jobage-minutes 30 constructs f_TPR=r1800 in the request URL", async () => {
|
||||
let capturedUrl = "";
|
||||
globalThis.fetch = (async (input: RequestInfo | URL) => {
|
||||
capturedUrl = typeof input === "string" ? input : input.toString();
|
||||
return new Response("");
|
||||
}) as typeof fetch;
|
||||
|
||||
const code = await runSearch({
|
||||
location: "Remote",
|
||||
jobage: 9999,
|
||||
jobageMinutes: 30,
|
||||
page: 1,
|
||||
format: "json",
|
||||
});
|
||||
|
||||
expect(code).toBe(0);
|
||||
expect(capturedUrl).toContain("f_TPR=r1800");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user