-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ccip-develop' into price-reader
- Loading branch information
Showing
4 changed files
with
237 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package exectypes | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestPluginState_Next(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
p PluginState | ||
want PluginState | ||
isPanic bool | ||
}{ | ||
{ | ||
name: "Zero value", | ||
p: Unknown, | ||
want: GetCommitReports, | ||
}, | ||
{ | ||
name: "Phase 1 to 2", | ||
p: GetCommitReports, | ||
want: GetMessages, | ||
}, | ||
{ | ||
name: "Phase 2 to 1", | ||
p: GetMessages, | ||
want: GetCommitReports, | ||
}, | ||
{ | ||
name: "panic", | ||
p: PluginState("ElToroLoco"), | ||
isPanic: true, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
tt := tt | ||
t.Run(tt.name, func(t *testing.T) { | ||
t.Parallel() | ||
if tt.isPanic { | ||
require.Panics(t, func() { | ||
tt.p.Next() | ||
}) | ||
return | ||
} | ||
|
||
if got := tt.p.Next(); got != tt.want { | ||
t.Errorf("Next() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |
Oops, something went wrong.