Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(task): Add wait for taskID #439

Merged
merged 1 commit into from
Jan 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ trait WaitForTaskDsl {
case object waitFor {
def task(task: AlgoliaTask): WaitForTaskDefinition =
WaitForTaskDefinition(task.idToWaitFor())

def task(taskID: Long): WaitForTaskDefinition =
WaitForTaskDefinition(taskID)
}

implicit object WaitForTaskDefinitionExecutable
Expand Down
15 changes: 15 additions & 0 deletions src/test/scala/algolia/dsl/WaitForTaskTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ class WaitForTaskTest extends AlgoliaTest {
waitFor task Task(1L, None) from "toto" baseDelay 5 maxDelay 100
}

it("wait for a taskId") {
waitFor task 1L from "toto" baseDelay 5 maxDelay 100
}

it("should call API") {
(waitFor task Task(1L, None) from "toto").build() should be(
HttpPayload(
Expand All @@ -48,6 +52,17 @@ class WaitForTaskTest extends AlgoliaTest {
)
)
}

it("should call API for a taskID") {
(waitFor task 1L from "toto").build() should be(
HttpPayload(
GET,
Seq("1", "indexes", "toto", "task", "1"),
isSearch = true,
requestOptions = None
)
)
}
}

}