MCPcopy Create free account
hub / github.com/conforma/cli / Test_SetupStateRestoreValue

Function Test_SetupStateRestoreValue

acceptance/testenv/testenv_test.go:148–163  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

146}
147
148func Test_SetupStateRestoreValue(t *testing.T) {
149 loader = func(filename string) ([]byte, error) {
150 return []byte(`{"testenv.key.0": {"number": 3, "str": "hi"}}`), nil
151 }
152
153 ctx := context.WithValue(context.TODO(), RestoreStubEnvironment, true)
154
155 var s *stateful
156 ctx, err := SetupState(ctx, &s)
157
158 assert.NoError(t, err)
159
160 expectedStateful := stateful{Number: 3, Str: "hi"}
161 assert.Equal(t, expectedStateful, *s)
162 assert.Equal(t, &expectedStateful, FetchState[stateful](ctx))
163}
164
165func Test_Persist(t *testing.T) {
166 var persisted string

Callers

nothing calls this directly

Calls 1

SetupStateFunction · 0.85

Tested by

no test coverage detected