From 06cec23565ac5d039254484b549127e02009d47e Mon Sep 17 00:00:00 2001 From: Mohammad Abdelgalil Date: Thu, 9 May 2024 20:55:25 +0100 Subject: [PATCH] The way Golang process logical OR operation is that, if the left hand side expression is true, the OR expression returns true without executing the right hand side expression. This is called short circuiting. Using OR operation in this test will secceed even if the right hand side is false. This commit exchange the OR with AND expression which requires both left and right hand sides to be true which is the correct logic for this test. --- db/sqlc/transfer_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/sqlc/transfer_test.go b/db/sqlc/transfer_test.go index a976d059..958a5ed7 100644 --- a/db/sqlc/transfer_test.go +++ b/db/sqlc/transfer_test.go @@ -74,6 +74,6 @@ func TestListTransfer(t *testing.T) { for _, transfer := range transfers { require.NotEmpty(t, transfer) - require.True(t, transfer.FromAccountID == account1.ID || transfer.ToAccountID == account1.ID) + require.True(t, transfer.FromAccountID == account1.ID && transfer.ToAccountID == account1.ID) } }