summaryrefslogtreecommitdiff
path: root/types/protocol/protocol_test.go
blob: 481d2c62a452dc64c05d46abd7270d45f27d737a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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)
		}
	}
}