Skip to content

Commit e7a1abb

Browse files
authored
Merge pull request #1266 from code-corps/fix-sync-test
Fix sync test
2 parents 656571c + e59cf02 commit e7a1abb

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test/lib/code_corps/github/sync/sync_test.exs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ defmodule CodeCorps.GitHub.SyncTest do
44
use CodeCorps.DbAccessCase
55

66
import CodeCorps.GitHub.TestHelpers
7+
import Ecto.Query, only: [where: 3]
78

89
alias CodeCorps.{
910
Comment,
@@ -193,14 +194,18 @@ defmodule CodeCorps.GitHub.SyncTest do
193194
assert Repo.aggregate(Task, :count, :id) == 3
194195
assert Repo.aggregate(User, :count, :id) == 2
195196

196-
%TaskList{tasks: done_tasks} =
197-
TaskList |> Repo.get_by(done: true) |> Repo.preload(:tasks)
197+
# Tasks closed more than 30 days ago
198+
archived_tasks =
199+
Task
200+
|> where([object], is_nil(object.task_list_id))
201+
|> Repo.all()
202+
198203
%TaskList{tasks: inbox_tasks} =
199204
TaskList |> Repo.get_by(inbox: true) |> Repo.preload(:tasks)
200205
%TaskList{tasks: pull_requests_tasks} =
201206
TaskList |> Repo.get_by(pull_requests: true) |> Repo.preload(:tasks)
202207

203-
assert Enum.count(done_tasks) == 1
208+
assert Enum.count(archived_tasks) == 1
204209
assert Enum.count(inbox_tasks) == 1
205210
assert Enum.count(pull_requests_tasks) == 1
206211
end

0 commit comments

Comments
 (0)