Implements tests/_plans and previously deferred packages; updates plan README with new coverage numbers.
39 lines
1.0 KiB
Go
39 lines
1.0 KiB
Go
package transform
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"git.warky.dev/wdevs/relspecgo/pkg/models"
|
|
)
|
|
|
|
// Validation and normalization are currently pass-through stubs; these tests
|
|
// pin that contract (no error, input returned unchanged).
|
|
func TestTransformerStubs(t *testing.T) {
|
|
tr := NewTransformer()
|
|
if tr == nil {
|
|
t.Fatal("nil transformer")
|
|
}
|
|
db := models.InitDatabase("d")
|
|
schema := models.InitSchema("public")
|
|
table := models.InitTable("t", "public")
|
|
|
|
if err := tr.ValidateDatabase(db); err != nil {
|
|
t.Error(err)
|
|
}
|
|
if err := tr.ValidateSchema(schema); err != nil {
|
|
t.Error(err)
|
|
}
|
|
if err := tr.ValidateTable(table); err != nil {
|
|
t.Error(err)
|
|
}
|
|
if got, err := tr.NormalizeDatabase(db); err != nil || got != db {
|
|
t.Errorf("NormalizeDatabase = %v, %v", got, err)
|
|
}
|
|
if got, err := tr.NormalizeSchema(schema); err != nil || got != schema {
|
|
t.Errorf("NormalizeSchema = %v, %v", got, err)
|
|
}
|
|
if got, err := tr.NormalizeTable(table); err != nil || got != table {
|
|
t.Errorf("NormalizeTable = %v, %v", got, err)
|
|
}
|
|
}
|