mirror of
https://github.com/qdm12/gluetun.git
synced 2026-07-25 11:56:24 +02:00
chore(updater): move updater packages to pkg/updaters/<name>
This commit is contained in:
@@ -4,16 +4,17 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/qdm12/gluetun/internal/constants/providers"
|
||||
"github.com/qdm12/gluetun/internal/constants/vpn"
|
||||
"github.com/qdm12/gluetun/pkg/updaters/constants"
|
||||
"github.com/qdm12/gluetun/pkg/updaters/models"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func Test_Servers_ToMarkdown(t *testing.T) {
|
||||
func Test_serversToMarkdown(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
testCases := map[string]struct {
|
||||
provider string
|
||||
servers Servers
|
||||
servers models.Servers
|
||||
formatted string
|
||||
errMessage string
|
||||
}{
|
||||
@@ -23,8 +24,8 @@ func Test_Servers_ToMarkdown(t *testing.T) {
|
||||
},
|
||||
providers.Cyberghost: {
|
||||
provider: providers.Cyberghost,
|
||||
servers: Servers{
|
||||
Servers: []Server{
|
||||
servers: models.Servers{
|
||||
Servers: []models.Server{
|
||||
{Country: "a", UDP: true, Hostname: "xa"},
|
||||
{Country: "b", TCP: true, Hostname: "xb"},
|
||||
},
|
||||
@@ -36,10 +37,10 @@ func Test_Servers_ToMarkdown(t *testing.T) {
|
||||
},
|
||||
providers.Fastestvpn: {
|
||||
provider: providers.Fastestvpn,
|
||||
servers: Servers{
|
||||
Servers: []Server{
|
||||
{Country: "a", Hostname: "xa", VPN: vpn.OpenVPN, TCP: true},
|
||||
{Country: "b", Hostname: "xb", VPN: vpn.OpenVPN, UDP: true},
|
||||
servers: models.Servers{
|
||||
Servers: []models.Server{
|
||||
{Country: "a", Hostname: "xa", VPN: constants.OpenVPN, TCP: true},
|
||||
{Country: "b", Hostname: "xb", VPN: constants.OpenVPN, UDP: true},
|
||||
},
|
||||
},
|
||||
formatted: "| Country | Hostname | VPN | TCP | UDP |\n" +
|
||||
@@ -53,7 +54,7 @@ func Test_Servers_ToMarkdown(t *testing.T) {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
markdown, err := testCase.servers.toMarkdown(testCase.provider)
|
||||
markdown, err := serversToMarkdown(testCase.servers, testCase.provider)
|
||||
|
||||
assert.Equal(t, testCase.formatted, markdown)
|
||||
if testCase.errMessage != "" {
|
||||
|
||||
Reference in New Issue
Block a user