Skip to content

Commit

Permalink
Add error case test (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig Pastro committed Oct 19, 2023
1 parent 292d669 commit 2a8b009
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mocks/row.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions pgmq_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,12 @@ func TestErrorCases(t *testing.T) {
require.ErrorContains(t, err, "postgres error")
})

t.Run("createUnloggedQueueError", func(t *testing.T) {
mockDB.EXPECT().Exec(ctx, "SELECT pgmq.create_unlogged($1)", queue).Return(cmdTag, testErr)
err := q.CreateUnloggedQueue(ctx, queue)
require.ErrorContains(t, err, "postgres error")
})

t.Run("dropQueueError", func(t *testing.T) {
mockDB.EXPECT().Exec(ctx, "SELECT pgmq.drop_queue($1)", queue).Return(cmdTag, testErr)
err := q.DropQueue(ctx, queue)
Expand Down

0 comments on commit 2a8b009

Please sign in to comment.