craban/services/store/store_test.go

33 lines
591 B
Go
Raw Normal View History

2021-09-11 19:50:34 +01:00
package store
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestAddPathOptions(t *testing.T) {
testCases := []struct {
Name string
Path string
Expected string
}{
{
Name: "Path is memory",
Path: ":memory:",
Expected: ":memory:?_foreign_keys=true",
},
{
Name: "Path is a file path",
Path: "./some_file.sqlite",
Expected: "file:./some_file.sqlite?_foreign_keys=true",
},
}
for _, tc := range testCases {
t.Run(tc.Name, func(t *testing.T) {
require.Equal(t, tc.Expected, addPathOptions(tc.Path))
})
}
}