package stonesql import ( "context" "fmt" "testing" "gitstormr.dev/stone-utils/stonesql/test" ) type migratorSuccessMock struct{} func (m *migratorSuccessMock) ExecuteMigration( ctx context.Context, name string, sqlContent string, ) error { fmt.Println(name, sqlContent) return nil } type migratorFailureMock struct{} func (m *migratorFailureMock) ExecuteMigration( ctx context.Context, name string, sqlContent string, ) error { return fmt.Errorf("failed to execute migration %s", name) } func Test_MigrationSuccess(t *testing.T) { migrator := &migratorSuccessMock{} err := RunMigrations(context.Background(), migrator, test.TestFS, ".") if err != nil { t.Error(err) } } func Test_MigrationFailure(t *testing.T) { migrator := &migratorFailureMock{} err := RunMigrations(context.Background(), migrator, test.TestFS, ".") if err == nil { t.Error("expected error") } }