package runner import ( "errors" "os" "path/filepath" "testing" ) // The bank read-out is opened at the path the ENGINE published (`artifacts.bank_export`, row 213) — // the derivation from `book.yaml` that used to live here copied another zone's path convention and // is gone with this pin's previous edition. // // Mutation caught: treating an empty published path as "no bank yet" — on an engine build from // before the envelope that would silently stop every bank refresh, so it must refuse loudly instead. func TestTheBankIsReadAtThePathTheEnginePublished(t *testing.T) { dir := t.TempDir() path := filepath.Join(dir, "sample-zh.db.bank.json") if _, err := ReadBank(path); !errors.Is(err, ErrNoBank) { t.Fatalf("a published place with no file yet answered %v, want ErrNoBank", err) } if err := os.WriteFile(path, []byte(`{"bank_version":"tm-bank-v1","book_id":"sample-zh","terms":[]}`), 0o644); err != nil { t.Fatal(err) } if _, err := ReadBank(path); err != nil { t.Fatalf("the read-out at the published path: %v", err) } if _, err := ReadBank(""); err == nil || errors.Is(err, ErrNoBank) { t.Errorf("an empty published path answered %v, want a loud refusal naming the missing envelope", err) } }