2021-09-23 13:13:17 +00:00
|
|
|
package models
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func Test_CyberghostServers_ToMarkdown(t *testing.T) {
|
|
|
|
|
t.Parallel()
|
|
|
|
|
|
|
|
|
|
servers := CyberghostServers{
|
|
|
|
|
Servers: []CyberghostServer{
|
2021-09-23 13:54:24 +00:00
|
|
|
{Country: "a", UDP: true, Hostname: "xa"},
|
|
|
|
|
{Country: "b", TCP: true, Hostname: "xb"},
|
2021-09-23 13:13:17 +00:00
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
markdown := servers.ToMarkdown()
|
2021-09-23 13:54:24 +00:00
|
|
|
const expected = "| Country | Hostname | TCP | UDP |\n" +
|
|
|
|
|
"| --- | --- | --- | --- |\n" +
|
2021-10-25 22:38:59 +00:00
|
|
|
"| a | `xa` | ❌ | ✅ |\n" +
|
|
|
|
|
"| b | `xb` | ✅ | ❌ |\n"
|
2021-09-23 13:13:17 +00:00
|
|
|
|
|
|
|
|
assert.Equal(t, expected, markdown)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func Test_FastestvpnServers_ToMarkdown(t *testing.T) {
|
|
|
|
|
t.Parallel()
|
|
|
|
|
|
|
|
|
|
servers := FastestvpnServers{
|
|
|
|
|
Servers: []FastestvpnServer{
|
|
|
|
|
{Country: "a", Hostname: "xa", TCP: true},
|
|
|
|
|
{Country: "b", Hostname: "xb", UDP: true},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
markdown := servers.ToMarkdown()
|
|
|
|
|
const expected = "| Country | Hostname | TCP | UDP |\n" +
|
|
|
|
|
"| --- | --- | --- | --- |\n" +
|
2021-10-25 22:38:59 +00:00
|
|
|
"| a | `xa` | ✅ | ❌ |\n" +
|
|
|
|
|
"| b | `xb` | ❌ | ✅ |\n"
|
2021-09-23 13:13:17 +00:00
|
|
|
|
|
|
|
|
assert.Equal(t, expected, markdown)
|
|
|
|
|
}
|