Initial commit of Descrybe v2 without local scratch artifacts.
Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package eprel
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// stubFetcher verifies the Fetcher interface is usable from processing tests.
|
||||
type stubFetcher struct {
|
||||
enabled bool
|
||||
data *Data
|
||||
err error
|
||||
calls int
|
||||
lastID string
|
||||
}
|
||||
|
||||
func (s *stubFetcher) Enabled() bool { return s.enabled }
|
||||
|
||||
func (s *stubFetcher) Fetch(_ context.Context, id string) (*Data, error) {
|
||||
s.calls++
|
||||
s.lastID = id
|
||||
return s.data, s.err
|
||||
}
|
||||
|
||||
func TestFetcherInterface(t *testing.T) {
|
||||
var _ Fetcher = (*Client)(nil)
|
||||
var _ Fetcher = Disabled{}
|
||||
var _ Fetcher = (*stubFetcher)(nil)
|
||||
|
||||
st := &stubFetcher{enabled: true, data: &Data{ID: "1", Label: "L"}}
|
||||
got, err := st.Fetch(context.Background(), "1")
|
||||
if err != nil || got.ID != "1" || st.calls != 1 {
|
||||
t.Fatalf("stub: %#v err=%v", got, err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user