From a23c3e61c5d89ef67973891b5b3a176c06e1b174 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Wed, 12 Apr 2023 22:52:49 +0200 Subject: Refactor: Split internal server into multiple packages - Pass contexts - Have separate packages for e.g. custom, institute and secure - internet servers, profiles.... - Return types from the public ./types package with a Public() method --- internal/server/profile_test.go | 100 ---------------------------------------- 1 file changed, 100 deletions(-) delete mode 100644 internal/server/profile_test.go (limited to 'internal/server/profile_test.go') diff --git a/internal/server/profile_test.go b/internal/server/profile_test.go deleted file mode 100644 index d6a7e9d..0000000 --- a/internal/server/profile_test.go +++ /dev/null @@ -1,100 +0,0 @@ -package server - -import "testing" - -func Test_CurrentProfileIndex(t *testing.T) { - testCases := []struct { - profiles []Profile - current string - index int - }{ - { - profiles: []Profile{ - { - ID: "a", - DisplayName: "b", - VPNProtoList: []string{"openvpn", "wireguard"}, - }, - }, - current: "a", - index: 0, - }, - { - profiles: []Profile{ - { - ID: "a", - DisplayName: "a", - VPNProtoList: []string{"openvpn", "wireguard"}, - }, - { - ID: "b", - DisplayName: "b", - VPNProtoList: []string{"openvpn", "wireguard"}, - }, - }, - current: "b", - index: 1, - }, - { - profiles: []Profile{ - { - ID: "a", - DisplayName: "a", - VPNProtoList: []string{"openvpn", "wireguard"}, - }, - { - ID: "b", - DisplayName: "b", - VPNProtoList: []string{"openvpn", "wireguard"}, - }, - }, - current: "", - index: 0, - }, - { - profiles: []Profile{ - { - ID: "a", - DisplayName: "a", - VPNProtoList: []string{"openvpn", "wireguard"}, - }, - { - ID: "b", - DisplayName: "b", - VPNProtoList: []string{"openvpn", "wireguard"}, - }, - }, - current: "", - index: 0, - }, - { - profiles: []Profile{ - { - ID: "a", - DisplayName: "a", - VPNProtoList: []string{"openvpn", "wireguard"}, - }, - { - ID: "b", - DisplayName: "b", - VPNProtoList: []string{"openvpn", "wireguard"}, - }, - }, - current: "idonotexist", - index: 0, - }, - } - - for _, tc := range testCases { - pri := &ProfileInfo{ - Current: tc.current, - Info: ProfileListInfo{ - ProfileList: tc.profiles, - }, - } - got := pri.CurrentProfileIndex() - if got != tc.index { - t.Fatalf("failed getting profile index, got: '%v', want: '%v'", got, tc.index) - } - } -} -- cgit v1.2.3