package builder import ( "os" "path/filepath" "testing" "github.com/novox/mesh-controller/internal/beside" "github.com/novox/mesh-controller/internal/catalogue" ) // **A build that needs the registry fails loudly while the build agent has none** (novox/hq ADR 0336 // §5, §6, issue 121). On a holder with neither the npm-package-registry binding nor the genesis // document, a `package` artifact, an image whose Dockerfile names .npmrc and a TypeScript artifact // with an `@novox/` dependency each fail before anything is built or published, naming the machine, // the unbound requirement and the module that provides it. A Go artifact, and an image that does not // name .npmrc, build there as before. // **The build's log says which registry it resolved from** (novox/hq ADR 0336 §4). // The refusal names the module that provides the registry; it is the catalogue's provider. func TestTheRegistryABuildIsRefusedForNamesItsProvider(t *testing.T) { raw, err := os.ReadFile(filepath.Join(beside.Catalogue(t), RegistryProvider, "module.json")) if err != nil { t.Fatal(err) } forge, err := catalogue.ParseManifest(raw) if err != nil { t.Fatal(err) } provides := false for _, p := range forge.Provides { provides = provides || p.Name == RegistryRequirement } if !provides { t.Fatalf("%s does not provide %s, which a refused build names it for", RegistryProvider, RegistryRequirement) } }