Skip to content

Commit

Permalink
updates test template
Browse files Browse the repository at this point in the history
  • Loading branch information
tlietz committed Feb 21, 2025
1 parent dfbb791 commit a4033cc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions gen/templates/models/table/01_types_test.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@ func Test{{$tAlias.UpSingular}}UniqueConstraintErrors(t *testing.T) {
expectedErr *models.UniqueConstraintError
applyFn func(tpl *factory.{{$tAlias.UpSingular}}Template, obj *models.{{$tAlias.UpSingular}})
}{
{{range $constraint := $table.Constraints.Uniques}}
{{- $errName := printf "ErrUnique%s" (join "_and_" $constraint.Columns | camelcase) -}}
{{range $index := $table.Indexes}}
{{- $errName := printf "ErrUnique%s" ($index.Name | camelcase) -}}
{
name: "{{$errName}}",
expectedErr: models.{{$tAlias.UpSingular}}Errors.{{$errName}},
applyFn: func(tpl *factory.{{$tAlias.UpSingular}}Template, obj *models.{{$tAlias.UpSingular}}) {
tpl.Apply(
factory.{{$tAlias.UpSingular}}Mods.RandomizeAllColumns(nil),
{{range $columnName := $constraint.Columns}}
{{- $colAlias := $tAlias.Column $columnName -}}
{{range $indexColumn := $index.Columns}}
{{- $colAlias := $tAlias.Column $indexColumn.Name -}}
factory.{{$tAlias.UpSingular}}Mods.{{$colAlias}}(obj.{{$colAlias}}),
{{end}}
)
Expand Down

0 comments on commit a4033cc

Please sign in to comment.