1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2024-11-21 13:35:49 +02:00
pocketbase/tools/migrate/list_test.go

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)
}
}
}