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
28 lines
1.1 KiB
Go
28 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/meshcatalog"
|
|
)
|
|
|
|
// TestTheManifestOfAnEntryIsReadByItsDigest: the builder reads a manifest from the entry that holds it, by the entry's manifest
|
|
// digest (design 47 G §348), and an entry with no manifest keeps none.
|
|
func TestTheManifestOfAnEntryIsReadByItsDigest(t *testing.T) {
|
|
m := &entryManifests{}
|
|
e := meshcatalog.CatalogEntry{Module: "netcheck", ManifestDigest: "sha256:aa", Manifest: map[string]any{"module": "netcheck", "version": "1"}}
|
|
if err := m.keep(e); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if mf, err := m.Manifest(context.Background(), "sha256:aa"); err != nil || mf.Module != "netcheck" {
|
|
t.Errorf("Manifest(sha256:aa) = %+v, %v", mf, err)
|
|
}
|
|
if _, err := m.Manifest(context.Background(), "sha256:bb"); err == nil {
|
|
t.Error("Manifest of a digest no entry holds: want an error")
|
|
}
|
|
if err := m.keep(meshcatalog.CatalogEntry{Module: "bare"}); err != nil || len(m.byFp) != 1 {
|
|
t.Errorf("an entry with no manifest kept one: %v, %v", err, m.byFp)
|
|
}
|
|
}
|