Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / internal/modules/recruiting/manager_test.go |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 720d47fae476b0d38477ae4401697d372b1ea2bc |
| Branch | feature/opportunity-to-outcome |
| Path or archive member | internal/modules/recruiting/manager_test.go |
| Original SHA-256 | 47aeddd944556f0e315d6b3e1ce98b128aae2465d2a9eacc73c6653424467579 |
| Git blob SHA | 6b7ee6e553ca9177421f5649885f5067c6b1314b |
| Reading-copy SHA-256 | 47aeddd944556f0e315d6b3e1ce98b128aae2465d2a9eacc73c6653424467579 |
Recovered source transcript
Download complete source text ↓65 lines · 2.6 KB
package recruiting
import (
"testing"
"github.com/shopspring/decimal"
)
func num(s string) decimal.Decimal { return decimal.RequireFromString(s) }
// TIME TO FILL IS THE ONE WHERE DOWN IS BETTER, and this is why Better is computed on the server. A component
// deciding for itself gets it backwards on half the metrics, and a screen that colours a falling time to fill
// red is telling a manager their best month was their worst.
func TestDirectionAndBetterAreDifferentQuestions(t *testing.T) {
rising := compare(num("70"), num("60"), true)
if rising.Direction != "up" || rising.Better != "yes" {
t.Errorf("a rising fill rate: direction=%s better=%s, want up and yes", rising.Direction, rising.Better)
}
slower := compare(num("40"), num("30"), false)
if slower.Direction != "up" || slower.Better != "no" {
t.Errorf("a rising time to fill: direction=%s better=%s, want up and NO", slower.Direction, slower.Better)
}
faster := compare(num("21"), num("30"), false)
if faster.Direction != "down" || faster.Better != "yes" {
t.Errorf("a falling time to fill: direction=%s better=%s, want down and YES", faster.Direction, faster.Better)
}
}
// A previous of zero is not an infinite improvement. The direction is still reported, because up from nothing
// is genuinely up, but nothing here may produce a percentage.
func TestZeroPreviousDoesNotProduceAPercentage(t *testing.T) {
c := compare(num("2"), num("0"), true)
if c.Direction != "up" || c.Better != "yes" {
t.Fatalf("direction=%s better=%s, want up and yes", c.Direction, c.Better)
}
if c.Previous != "0" {
t.Errorf("previous = %q, want the honest zero", c.Previous)
}
}
// Flat is its own answer. Reporting it as up or down would invent a movement that did not happen.
func TestFlatIsFlatInBothFields(t *testing.T) {
c := compare(num("55"), num("55"), true)
if c.Direction != "flat" || c.Better != "flat" {
t.Fatalf("direction=%s better=%s, want flat and flat", c.Direction, c.Better)
}
}
// THE LOAD BANDS COME FROM PUBLISHED BENCHMARKS, not from invention: fourteen is the 2026 average and twenty
// to thirty is where practitioners say the work changes shape rather than merely gets busier. The boundaries
// are pinned because they are the whole reason the count is worth showing.
func TestLoadBandsMatchThePublishedBenchmarks(t *testing.T) {
for _, c := range []struct {
open int
want string
}{
{0, "ok"}, {14, "ok"}, {15, "watch"}, {19, "watch"},
{20, "strained"}, {29, "strained"}, {30, "overloaded"}, {45, "overloaded"},
} {
if got := loadBand(c.open); got != c.want {
t.Errorf("loadBand(%d) = %q, want %q", c.open, got, c.want)
}
}
}