-
Notifications
You must be signed in to change notification settings - Fork 108
/
Copy pathmatch_test.go
66 lines (55 loc) · 1.64 KB
/
match_test.go
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package popx
import (
"testing"
"github.com/stretchr/testify/require"
)
func Test_ParseMigrationFilenameSQLUp(t *testing.T) {
r := require.New(t)
m, err := ParseMigrationFilename("20190611004000_create_providers.up.sql")
r.NoError(err)
r.NotNil(m)
r.Equal(m.Version, "20190611004000")
r.Equal(m.Name, "create_providers")
r.Equal(m.DBType, "all")
r.Equal(m.Direction, "up")
r.Equal(m.Type, "sql")
r.Equal(m.Autocommit, false)
}
func Test_ParseMigrationFilenameSQLUpPostgres(t *testing.T) {
r := require.New(t)
m, err := ParseMigrationFilename("20190611004000_create_providers.pg.up.sql")
r.NoError(err)
r.NotNil(m)
r.Equal(m.Version, "20190611004000")
r.Equal(m.Name, "create_providers")
r.Equal(m.DBType, "postgres")
r.Equal(m.Direction, "up")
r.Equal(m.Type, "sql")
r.Equal(m.Autocommit, false)
}
func Test_ParseMigrationFilenameSQLUpAutocommit(t *testing.T) {
r := require.New(t)
m, err := ParseMigrationFilename("20190611004000_create_providers.autocommit.up.sql")
r.NoError(err)
r.NotNil(m)
r.Equal(m.Version, "20190611004000")
r.Equal(m.Name, "create_providers")
r.Equal(m.DBType, "all")
r.Equal(m.Direction, "up")
r.Equal(m.Type, "sql")
r.Equal(m.Autocommit, true)
}
func Test_ParseMigrationFilenameSQLDownAutocommit(t *testing.T) {
r := require.New(t)
m, err := ParseMigrationFilename("20190611004000_create_providers.mysql.autocommit.down.sql")
r.NoError(err)
r.NotNil(m)
r.Equal(m.Version, "20190611004000")
r.Equal(m.Name, "create_providers")
r.Equal(m.DBType, "mysql")
r.Equal(m.Direction, "down")
r.Equal(m.Type, "sql")
r.Equal(m.Autocommit, true)
}