Files
narratio/internal/adapters/notarius/fake.go

25 lines
624 B
Go
Raw Normal View History

2026-08-09 23:47:38 +00:00
package notarius
import "context"
// FakeRunner is a configurable in-memory runner for stage tests.
type FakeRunner struct {
Requests []RunRequest
Result RunResult
Err error
}
// Run records the request and returns the configured result or error.
func (f *FakeRunner) Run(ctx context.Context, req RunRequest) (RunResult, error) {
if err := ctx.Err(); err != nil {
return RunResult{}, err
}
2026-08-29 15:16:06 +00:00
copyRequest := req
copyRequest.References = append([]ReferenceBinding(nil), req.References...)
f.Requests = append(f.Requests, copyRequest)
2026-08-09 23:47:38 +00:00
if f.Err != nil {
return RunResult{}, f.Err
}
return f.Result, nil
}