From c5ecbe1bd480af4236fbde5975adca14b502fbce Mon Sep 17 00:00:00 2001 From: akushman Date: Sun, 15 Dec 2019 18:16:08 +0100 Subject: [PATCH] #36: Fix join tests --- builder_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/builder_test.go b/builder_test.go index dc21091..72c1192 100644 --- a/builder_test.go +++ b/builder_test.go @@ -539,7 +539,7 @@ func TestDB_AllJoins(t *testing.T) { res, err := db.Table(UsersTable).Select("name", "post", "user_id").InnerJoin(PostsTable, "users.id", "=", "posts.user_id").Get() assert.NoError(t, err) - assert.Equal(t, len(res), len(batchPosts)) + assert.Equal(t, len(res), len(batchPosts)-1) res, err = db.Table(PostsTable).Select("name", "post", "user_id").RightJoin(UsersTable, "posts.user_id", "=", "users.id").Get() assert.NoError(t, err) @@ -549,18 +549,18 @@ func TestDB_AllJoins(t *testing.T) { res, err = db.Table(UsersTable).Select("name", "post", "user_id").FullJoin(PostsTable, "users.id", "=", "posts.user_id").Get() assert.NoError(t, err) - assert.Equal(t, len(res), len(batchUsers)) + assert.Equal(t, len(res), len(batchUsers)+1) res, err = db.Table(UsersTable).Select("name", "post", "user_id").FullJoin(PostsTable, "users.id", "=", "posts.user_id").Get() assert.NoError(t, err) - assert.Equal(t, len(res), len(batchUsers)) + assert.Equal(t, len(res), len(batchUsers)+1) // note InRandomOrder check res, err = db.Table(UsersTable).Select("name", "post", "user_id").FullJoin(PostsTable, "users.id", "=", "posts.user_id").InRandomOrder().Get() assert.NoError(t, err) - assert.Equal(t, len(res), len(batchUsers)) + assert.Equal(t, len(res), len(batchUsers)+1) db.Truncate(PostsTable) db.Truncate(UsersTable)