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:
@@ -1,5 +1,5 @@
|
||||
import { describe, test, expect } from "bun:test";
|
||||
import { parseJobCards, parseJobDetail, extractDivContent } from "../src/helpers";
|
||||
import { parseJobCards, parseJobDetail, extractDivContent, minutesToTPR } from "../src/helpers";
|
||||
|
||||
// Minimal search-card markup: parseJobCards splits on the job-posting URN and
|
||||
// needs an id, a base-search-card__title, and a full-link. Everything else is
|
||||
@@ -111,3 +111,16 @@ describe("extractDivContent", () => {
|
||||
expect(job.description).toContain("We are hiring!");
|
||||
});
|
||||
});
|
||||
|
||||
describe("minutesToTPR", () => {
|
||||
test("converts minutes to an f_TPR seconds window", () => {
|
||||
expect(minutesToTPR(30)).toBe("r1800");
|
||||
expect(minutesToTPR(1)).toBe("r60");
|
||||
expect(minutesToTPR(1440)).toBe("r86400"); // matches jobageToTPR(1)
|
||||
});
|
||||
|
||||
test("returns null for non-positive input", () => {
|
||||
expect(minutesToTPR(0)).toBeNull();
|
||||
expect(minutesToTPR(-5)).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user