aboutsummaryrefslogtreecommitdiffsponsor
path: root/internal/service/mirror_test.go
blob: f9411e2bb0e97593d2e8976246e8de0ecdc02bd6 (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
package service

import (
	"testing"

	"git.server.ky/slackcoder/mirror/internal"
	"github.com/BurntSushi/toml"
	"github.com/stretchr/testify/require"
)

func TestMirrorUnmarshalTOML(t *testing.T) {
	str := internal.MustTOML(map[string]interface{}{
		"method": "git",
		"from":   "https://git.taler.net/merchant.git",
		"to":     "/mirror/merchant",
	})

	exp := Mirror{
		Method: "git",
		From:   internal.MustURL("https://git.taler.net/merchant.git"),
		To:     internal.MustURL("/mirror/merchant"),
	}

	var s Mirror

	err := toml.Unmarshal([]byte(str), &s)

	require.NoError(t, err)
	require.Equal(t, exp.String(), s.String())
}