summaryrefslogtreecommitdiff
path: root/types/protocol
diff options
context:
space:
mode:
authorJeroen Wijenbergh <jeroenwijenbergh@protonmail.com>2024-05-02 11:18:43 +0200
committerJeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com>2024-05-24 13:25:11 +0200
commit1514f509b6f2f1daa620ede667d0b86363a82c66 (patch)
tree97e38cc869f6741687b4be62d3cd2bf1158d91f1 /types/protocol
parent2f0510f87400ac4460ef610055ca8169e486dae2 (diff)
Types Protocol: Add Test
Diffstat (limited to 'types/protocol')
-rw-r--r--types/protocol/protocol_test.go34
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)
+ }
+ }
+}