style: reformat test tables
This commit is contained in:
@@ -13,15 +13,30 @@ func TestSQLTypeToPrisma(t *testing.T) {
|
||||
schema.Enums = append(schema.Enums, &models.Enum{Name: "Role", Values: []string{"A"}})
|
||||
|
||||
tests := []struct{ in, want string }{
|
||||
{"text", "String"}, {"varchar(255)", "String"}, {"character varying", "String"}, {"char(1)", "String"},
|
||||
{"boolean", "Boolean"}, {"bool", "Boolean"},
|
||||
{"integer", "Int"}, {"int", "Int"}, {"int4", "Int"},
|
||||
{"bigint", "BigInt"}, {"int8", "BigInt"}, {"BIGINT", "BigInt"},
|
||||
{"double precision", "Float"}, {"float8", "Float"},
|
||||
{"numeric(10,2)", "Decimal"}, {"decimal", "Decimal"},
|
||||
{"timestamp", "DateTime"}, {"timestamptz", "DateTime"}, {"date", "DateTime"},
|
||||
{"jsonb", "Json"}, {"json", "Json"}, {"bytea", "Bytes"},
|
||||
{"role", "Role"}, {"unknown_type", "String"},
|
||||
{"text", "String"},
|
||||
{"varchar(255)", "String"},
|
||||
{"character varying", "String"},
|
||||
{"char(1)", "String"},
|
||||
{"boolean", "Boolean"},
|
||||
{"bool", "Boolean"},
|
||||
{"integer", "Int"},
|
||||
{"int", "Int"},
|
||||
{"int4", "Int"},
|
||||
{"bigint", "BigInt"},
|
||||
{"int8", "BigInt"},
|
||||
{"BIGINT", "BigInt"},
|
||||
{"double precision", "Float"},
|
||||
{"float8", "Float"},
|
||||
{"numeric(10,2)", "Decimal"},
|
||||
{"decimal", "Decimal"},
|
||||
{"timestamp", "DateTime"},
|
||||
{"timestamptz", "DateTime"},
|
||||
{"date", "DateTime"},
|
||||
{"jsonb", "Json"},
|
||||
{"json", "Json"},
|
||||
{"bytea", "Bytes"},
|
||||
{"role", "Role"},
|
||||
{"unknown_type", "String"},
|
||||
}
|
||||
// Repeat: the mapping used to depend on map iteration order.
|
||||
for i := 0; i < 50; i++ {
|
||||
|
||||
@@ -140,9 +140,15 @@ func TestFormatDefaultValue(t *testing.T) {
|
||||
in any
|
||||
want string
|
||||
}{
|
||||
{"now()", "now()"}, {"gen_random_uuid()", "uuid()"}, {"uuid_generate_v4()", "uuid()"},
|
||||
{"hello", `"hello"`}, {true, "true"}, {false, "false"},
|
||||
{42, "42"}, {int64(7), "7"}, {1.5, "1.5"},
|
||||
{"now()", "now()"},
|
||||
{"gen_random_uuid()", "uuid()"},
|
||||
{"uuid_generate_v4()", "uuid()"},
|
||||
{"hello", `"hello"`},
|
||||
{true, "true"},
|
||||
{false, "false"},
|
||||
{42, "42"},
|
||||
{int64(7), "7"},
|
||||
{1.5, "1.5"},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
if got := w.formatDefaultValue(tt.in); got != tt.want {
|
||||
|
||||
Reference in New Issue
Block a user