Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

提供内置的 MockClient #119

Open
ringsaturn opened this issue Dec 13, 2023 · 0 comments
Open

提供内置的 MockClient #119

ringsaturn opened this issue Dec 13, 2023 · 0 comments

Comments

@ringsaturn
Copy link

ringsaturn commented Dec 13, 2023

我们在 oap 项目中在使用这个项目的 Apollo Client,目前是用 uber-go/mock 手动做了一个 Mock:

GOBASEPATH=$(shell go env var GOPATH | xargs)

gen:
	mockgen -source=$(GOBASEPATH)/pkg/mod/github.com/philchia/agollo/[email protected]/client.go -destination=mock_client_test.go -package=oap_test

期望这个项目直接提供一个 MockClient, 预期效果:

import (
    	// ...
    	"github.com/philchia/agollo/v4/mock_client"
    	// ...
)

func TestFoo(t *testing.T){
    	ctrl := gomock.NewController(t)
	defer ctrl.Finish()
	client := mock_client.NewMockClient(ctrl)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant