Skip to content

Commit

Permalink
Migrate tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau-lilly committed Dec 4, 2023
1 parent 65e4159 commit 332a535
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions tests/interactive/test-mermaid.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mermaid <- function(x) {
DiagrammeR::mermaid(paste0(x, collapse = "\n"))
cat(paste0(x, collapse = "\n"))
}

# Should show a glimpse.
Expand Down Expand Up @@ -27,7 +27,7 @@ vis <- mermaid_init(network = net)
vis$update()
mermaid(vis$visual)

# Same with everything built.
# Same with everything completed.
net <- inspection_init(pipeline_cross(), outdated = FALSE)
vis <- mermaid_init(network = net)
vis$update()
Expand Down Expand Up @@ -99,7 +99,7 @@ vis <- mermaid_init(network = net)
vis$update()
mermaid(vis$visual)

# Should show one started target.
# Should show one dispatched target.
tar_option_set(envir = new.env(parent = globalenv()))
x <- target_init("w", quote(Sys.sleep(100))) # Sleep for a long time.
pipeline <- pipeline_init(list(x))
Expand Down Expand Up @@ -244,7 +244,7 @@ mermaid(tar_mermaid(targets_only = FALSE))
# Should show a graph of 3 targets, f(), g(), and miscellaneous globals.
mermaid(tar_mermaid(targets_only = FALSE, callr_function = NULL))

# Should show a status of targets as built.
# Should show a status of targets as completed.
mermaid(tar_mermaid(targets_only = FALSE, outdated = FALSE))

# Should show a graph of just y1 and y2.
Expand Down
12 changes: 6 additions & 6 deletions tests/interactive/test-sleep.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ tar_test("branches complete even if patterns do not", {
})
tar_make() # Terminate before the second branch finishes.
out <- tar_progress()
expect_equal(out$progress[out$name == "x"], "built")
expect_equal(out$progress[out$name == "y"], "started")
expect_equal(out$progress[out$name == "y_bff916f9"], "built")
expect_equal(out$progress[out$name == "y_e15e8827"], "started")
expect_equal(out$progress[out$name == "x"], "completed")
expect_equal(out$progress[out$name == "y"], "dispatched")
expect_equal(out$progress[out$name == "y_bff916f9"], "completed")
expect_equal(out$progress[out$name == "y_e15e8827"], "dispatched")
tar_make() # The first branch should skip. Again, terminate early.
out <- tar_progress()
out <- out[out$progress != "skipped", ]
expect_equal(nrow(out), 2)
expect_equal(out$progress[out$name == "y"], "started")
expect_equal(out$progress[out$name == "y_e15e8827"], "started")
expect_equal(out$progress[out$name == "y"], "dispatched")
expect_equal(out$progress[out$name == "y_e15e8827"], "dispatched")
})

0 comments on commit 332a535

Please sign in to comment.