The delivery repository's contracts and SDK live under modules/ as mesh-delivery-contracts and mesh-delivery-sdk, their Go module paths renamed to match the folders (the TypeScript names already did), and every importer in mesh-delivery, mesh-catalog, mesh-host, mesh-tools and mesh-sdk follows in the same group: a design as it should be, one path per module, checked by the group's check building every importer. Builds: design 47 G §427, §88 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
40 lines
1007 B
Go
40 lines
1007 B
Go
package catalogkey
|
|
|
|
import (
|
|
"go/build"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestKeyPartRoundTripsAndRefusesOthers(t *testing.T) {
|
|
fp := "src2:" + strings.Repeat("a", 64)
|
|
part, err := KeyPart(fp)
|
|
if err != nil || part != strings.Repeat("a", 64) {
|
|
t.Fatalf("KeyPart = %q, %v", part, err)
|
|
}
|
|
if back, err := ParseKeyPart(part); err != nil || back != fp {
|
|
t.Fatalf("ParseKeyPart = %q, %v", back, err)
|
|
}
|
|
for _, bad := range []string{"src1:" + strings.Repeat("a", 64), "src2:abc", strings.Repeat("a", 64)} {
|
|
if _, err := KeyPart(bad); err == nil {
|
|
t.Errorf("KeyPart(%q) accepted", bad)
|
|
}
|
|
}
|
|
if _, err := ParseKeyPart("abc"); err == nil {
|
|
t.Error("ParseKeyPart(abc) accepted")
|
|
}
|
|
}
|
|
|
|
// Design 47 G §670: the package imports no bus.
|
|
func TestThePackageImportsNoBus(t *testing.T) {
|
|
p, err := build.ImportDir(".", 0)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for _, i := range p.Imports {
|
|
if strings.Contains(i, "nats") || strings.Contains(i, "/views") {
|
|
t.Errorf("catalogkey imports %s", i)
|
|
}
|
|
}
|
|
}
|