Skip to content

Commit

Permalink
rename to mockVerbProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
matt2e committed Apr 30, 2024
1 parent b338886 commit 96accdb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions go-runtime/ftl/ftltest/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ import (

type mockFunc func(ctx context.Context, req any) (resp any, err error)

// mockProvider keeps a mapping of verb references to mock functions.
// mockVerbProvider keeps a mapping of verb references to mock functions.
//
// It implements the CallOverrider interface to intercept calls with the mock functions.
type mockProvider struct {
type mockVerbProvider struct {
mocks map[ftl.Ref]mockFunc
}

var _ = (ftl.CallOverrider)(&mockProvider{})
var _ = (ftl.CallOverrider)(&mockVerbProvider{})

func newMockProvider() *mockProvider {
provider := &mockProvider{
func newMockVerbProvider() *mockVerbProvider {
provider := &mockVerbProvider{
mocks: map[ftl.Ref]mockFunc{},
}
return provider
}

func (m *mockProvider) OverrideCall(ctx context.Context, ref ftl.Ref, req any) (override bool, resp any, err error) {
func (m *mockVerbProvider) OverrideCall(ctx context.Context, ref ftl.Ref, req any) (override bool, resp any, err error) {
mock, ok := m.mocks[ref]
if ok {
resp, err = mock(ctx, req)
Expand Down

0 comments on commit 96accdb

Please sign in to comment.