package recruiting import "testing" // The forecast's honesty rules are pure, so they are provable here rather than only visible by seeding a // database and squinting at a number. Each was planted as a positive control first. func TestOpenStagesIsTheLadderWithoutItsLastRung(t *testing.T) { // Derived, never retyped. If somebody adds a rung to the funnel, the forecast must weight it without // anybody remembering to come here, and if somebody removes one the forecast must stop weighting it. if len(openStages) != len(ladder)-1 { t.Fatalf("openStages should be the ladder minus its last rung, got %v against %v", openStages, ladder) } for i, s := range openStages { if s != ladder[i] { t.Fatalf("openStages diverged from the ladder at %d: %q against %q", i, s, ladder[i]) } } // placed is an OUTCOME. Weighting it would count every existing placement again as a future one. for _, s := range openStages { if s == stagePlaced { t.Fatal("placed is an outcome and must never be forecast as open pipeline") } } } func TestEveryOpenStageHasAnOrdinal(t *testing.T) { // The conversion query narrows on furthest_stage_ord, so a stage with no ordinal would silently // measure against ordinal zero and return the whole table as its sample. for _, s := range openStages { ord, ok := stageOrd[s] if !ok { t.Fatalf("stage %q has no ordinal, its conversion sample would be the entire table", s) } if ord < 1 { t.Fatalf("stage %q has ordinal %d, which is a terminal marker rather than a rung", s, ord) } } } func TestTheGoalMetricsAreTheFiguresTheManagerAlreadyReads(t *testing.T) { // A goal on a metric the manager view does not report is a target nobody can ever see progress // against, so the vocabularies have to agree. These four are exactly the Phase 1 figures. for _, m := range []string{"placements", "submissions", "fill_rate", "time_to_fill_days"} { if !inGoalMetrics(m) { t.Fatalf("%s is reported by the manager view but cannot be committed to", m) } } if inGoalMetrics("revenue") { t.Fatal("a metric with no figure on screen must not be accepted as a goal") } } func TestTheSampleFloorIsAboveOne(t *testing.T) { // The floor is the whole reason the forecast can be trusted. At a floor of one, a single lucky // placement becomes a hundred percent conversion rate and the forecast becomes fiction. if forecastMinSample < 10 { t.Fatalf("a sample floor of %d is too low to distinguish a rate from an accident", forecastMinSample) } }