package main import "testing" // 1146/AC9: the warrant the controller checked covers exactly the repository on the git seat and the module paths the // merge holds; nothing else passes verbMayAsk on it. func TestTheFirstBuildWarrantCoversOnlyItsRepositoryAndItsModulePaths(t *testing.T) { ctx := withFirstBuildWarrant(t.Context(), "novox/mesh-delivery", []string{"", "view"}, "the Approve") w := firstBuildWarrantIn(ctx) for _, c := range []struct { source buildSource path string covers bool }{ {buildSource{Repository: "novox/mesh-delivery", Seat: "git"}, "", true}, {buildSource{Repository: "novox/mesh-delivery", Seat: "git"}, "/view/", true}, {buildSource{Repository: "novox/mesh-delivery", Seat: "git"}, "other", false}, {buildSource{Repository: "agent/mesh-delivery", Seat: "git"}, "", false}, {buildSource{Repository: "novox/mesh-delivery"}, "", false}, {buildSource{Repository: "novox/mesh-delivery", Seat: "elsewhere"}, "", false}, } { if got := w.covers(c.source, c.path); got != c.covers { t.Errorf("1146/AC9: %v at %q covered = %v, want %v", c.source, c.path, got, c.covers) } } if firstBuildWarrantIn(t.Context()).covers(buildSource{Repository: "novox/mesh-delivery", Seat: "git"}, "") { t.Error("1146/AC9: a context with no warrant covers an ask") } }