33 lines
591 B
Go
33 lines
591 B
Go
|
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))
|
||
|
})
|
||
|
}
|
||
|
}
|