diff options
| -rw-r--r-- | types/protocol/protocol_test.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/types/protocol/protocol_test.go b/types/protocol/protocol_test.go new file mode 100644 index 0000000..481d2c6 --- /dev/null +++ b/types/protocol/protocol_test.go @@ -0,0 +1,34 @@ +package protocol + +import "testing" + +func TestNew(t *testing.T) { + cases := []struct { + in string + want Protocol + }{ + { + in: "openvpn", + want: OpenVPN, + }, + { + in: "wireguard", + want: WireGuard, + }, + { + in: "wrong", + want: Unknown, + }, + { + in: "", + want: Unknown, + }, + } + + for _, c := range cases { + got := New(c.in) + if got != c.want { + t.Fatalf("got: %v, not equal to want: %v", got, c.want) + } + } +} |
