2021-03-30 12:16:46 +00:00
|
|
|
package spec_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/sunboyy/repogen/internal/spec"
|
|
|
|
)
|
|
|
|
|
|
|
|
type UpdateTypeTestCase struct {
|
|
|
|
Update spec.Update
|
|
|
|
ExpectedName string
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestUpdateTypeName(t *testing.T) {
|
|
|
|
testTable := []UpdateTypeTestCase{
|
|
|
|
{
|
|
|
|
Update: spec.UpdateModel{},
|
|
|
|
ExpectedName: "Model",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Update: spec.UpdateFields{},
|
|
|
|
ExpectedName: "Fields",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, testCase := range testTable {
|
|
|
|
t.Run(testCase.ExpectedName, func(t *testing.T) {
|
|
|
|
if testCase.Update.Name() != testCase.ExpectedName {
|
2021-03-31 11:44:31 +00:00
|
|
|
t.Errorf("Expected = %+v\nReceived = %+v", testCase.ExpectedName, testCase.Update.Name())
|
2021-03-30 12:16:46 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|