Skip to content

Commit 29f4c15

Browse files
anilsenaya631807682
authored andcommitted
Add test
1 parent 60b5532 commit 29f4c15

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

error_translator_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ func TestDialector_Translate(t *testing.T) {
3636
args: args{err: &pgconn.PgError{Code: "42703"}},
3737
want: gorm.ErrInvalidField,
3838
},
39+
{
40+
name: "it should return gorm.ErrCheckConstraintViolated error if the status code is 23514",
41+
args: args{err: &pgconn.PgError{Code: "23514"}},
42+
want: gorm.ErrCheckConstraintViolated,
43+
},
3944
}
4045
for _, tt := range tests {
4146
t.Run(tt.name, func(t *testing.T) {

0 commit comments

Comments
 (0)