Skip to content

Commit

Permalink
#36: Fix join tests
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurkushman committed Dec 15, 2019
1 parent 48c5572 commit c5ecbe1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit c5ecbe1

Please sign in to comment.