MCPcopy Create free account
hub / github.com/Facets-cloud/flow / TestLoadConstantsCorrupt

Function TestLoadConstantsCorrupt

internal/stats/model_test.go:51–62  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

49}
50
51func TestLoadConstantsCorrupt(t *testing.T) {
52 dir := t.TempDir()
53 // corrupt file → defaults (a stderr notice is also emitted, but asserting
54 // on stderr is brittle; the defaults return is the contract that matters)
55 p := filepath.Join(dir, "corrupt.json")
56 if err := os.WriteFile(p, []byte("not valid json"), 0o644); err != nil {
57 t.Fatal(err)
58 }
59 if got := LoadConstants(p); got != DefaultConstants() {
60 t.Errorf("corrupt file should give defaults, got %+v", got)
61 }
62}

Callers

nothing calls this directly

Calls 2

LoadConstantsFunction · 0.85
DefaultConstantsFunction · 0.85

Tested by

no test coverage detected