package main import "testing" // TestExtractRoleFromNeed locks the four query-shape patterns documented // in real_003_findings.md so a future change to the regex can't silently // drop coverage of any production-shape style. Real_001 used `need`-only; // real_003 confirmed `shorthand` cross-role bleed; the extended // extractor in real_003b covers `client_first` + `looking` and leaves // `shorthand` as a known limitation (no separator between role and city). func TestExtractRoleFromNeed(t *testing.T) { cases := []struct { name string query string want string }{ { "need style — original real_001 form", "Need 1 Forklift Operator in Detroit MI starting at 15:00 for Beacon Freight", "Forklift Operator", }, { "need with deadline trailer", "Need 4 Pickers in Detroit MI starting at 13:30 for Beacon Freight, deadline 2026-05-28", "Pickers", }, { "client_first style — added in real_003b", "Beacon Freight needs 1 Forklift Operator in Detroit MI at 15:00", "Forklift Operator", }, { "client_first with multi-word client", "Parallel Machining needs 5 Warehouse Associates in Kansas City MO at 09:00", "Warehouse Associates", }, { "looking style — added in real_003b", "Looking for 1 Forklift Operator at Beacon Freight in Detroit MI for 15:00 shift", "Forklift Operator", }, { "looking with multi-word role + 4-digit count", "Looking for 1234 Senior Production Supervisors at Heritage Foods in Flint MI for 08:30 shift", "Senior Production Supervisors", }, { "shorthand — known limitation, returns empty", "1 Forklift Operator Detroit MI 15:00 Beacon Freight", "", }, { "shorthand multi-word city — also empty", "5 Warehouse Associates Kansas City MO 09:00 Parallel Machining", "", }, { "lift-suite multi-constraint — no clean role, returns empty", "Forklift operator with OSHA-30, warehouse experience, day shift availability", "", }, { "OOD honesty signal — lift-suite, returns empty", "Dental hygienist with three years experience, Indianapolis area", "", }, } for _, c := range cases { t.Run(c.name, func(t *testing.T) { got := extractRoleFromNeed(c.query) if got != c.want { t.Errorf("extractRoleFromNeed(%q) = %q, want %q", c.query, got, c.want) } }) } }