feat: add backend

This commit is contained in:
Ludvig Lundgren 2021-08-11 15:26:17 +02:00
parent bc418ff248
commit a838d994a6
68 changed files with 9561 additions and 0 deletions

View file

@ -0,0 +1,58 @@
package database
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestDataSourceName(t *testing.T) {
type args struct {
configPath string
name string
}
tests := []struct {
name string
args args
want string
}{
{
name: "default",
args: args{
configPath: "",
name: "autobrr.db",
},
want: "autobrr.db",
},
{
name: "path_1",
args: args{
configPath: "/config",
name: "autobrr.db",
},
want: "/config/autobrr.db",
},
{
name: "path_2",
args: args{
configPath: "/config/",
name: "autobrr.db",
},
want: "/config/autobrr.db",
},
{
name: "path_3",
args: args{
configPath: "/config//",
name: "autobrr.db",
},
want: "/config/autobrr.db",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := DataSourceName(tt.args.configPath, tt.args.name)
assert.Equal(t, tt.want, got)
})
}
}