1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2024-11-24 17:07:00 +02:00
pocketbase/tools/migrate/list_test.go
2022-07-07 00:19:05 +03:00

34 lines
649 B
Go

package migrate
import (
"testing"
)
func TestMigrationsList(t *testing.T) {
l := MigrationsList{}
l.Register(nil, nil, "3_test.go")
l.Register(nil, nil, "1_test.go")
l.Register(nil, nil, "2_test.go")
l.Register(nil, nil /* auto detect file name */)
expected := []string{
"1_test.go",
"2_test.go",
"3_test.go",
"list_test.go",
}
items := l.Items()
if len(items) != len(expected) {
t.Fatalf("Expected %d items, got %d: \n%#v", len(expected), len(items), items)
}
for i, name := range expected {
item := l.Item(i)
if item.file != name {
t.Fatalf("Expected name %s for index %d, got %s", name, i, item.file)
}
}
}