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

Add .Unset method to mock #982

Merged
merged 11 commits into from
Jun 22, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update mock_test.go
  • Loading branch information
pdufour authored Jun 22, 2022
commit d921f420ce67f7e31821e6009dece3374541c376
10 changes: 5 additions & 5 deletions mock/mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ func Test_Mock_On_WithFuncTypeArg(t *testing.T) {
})
}

func Test_Mock_Off(t *testing.T) {
func Test_Mock_Unset(t *testing.T) {
// make a test impl object
var mockedService = new(TestExampleImplementation)

Expand All @@ -475,7 +475,7 @@ func Test_Mock_Off(t *testing.T) {
require.Equal(t, foundCall, call)

mockedService.
Off("TheExampleMethodFuncType", "argA")
Unset("TheExampleMethodFuncType", "argA")

found, foundCall = mockedService.findExpectedCall("TheExampleMethodFuncType", "argA")
require.Equal(t, -1, found)
Expand All @@ -489,7 +489,7 @@ func Test_Mock_Off(t *testing.T) {
})
}

func Test_Mock_Chained_Off(t *testing.T) {
func Test_Mock_Chained_Unset(t *testing.T) {
// make a test impl object
var mockedService = new(TestExampleImplementation)

Expand All @@ -503,8 +503,8 @@ func Test_Mock_Chained_Off(t *testing.T) {
Return(nil)

mockedService.
Off("TheExampleMethod2", 2, 2).
Off("TheExampleMethod3", 3, 3, 3)
Unset("TheExampleMethod2", 2, 2).
Unset("TheExampleMethod3", 3, 3, 3)

expectedCalls := []*Call{
{
Expand Down