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

findRecalSeries: add a parametrized test for the find_final_series() function #49

Closed
KristinaGomoryova opened this issue Sep 6, 2024 · 0 comments · Fixed by #50
Closed
Assignees

Comments

@KristinaGomoryova
Copy link
Collaborator

Currently only the test for the mode = TRUE is implemented, we need also a parametrized test for mode = FALSE.

Corresponding lines of code:

Actual test:

test_that("Positive final series work", {
  df <- readRDS("test-data/scores_df_full.rds")
  expected <- readRDS("test-data/final_seriesTRUE.rds")
  actual <- find_final_series(df, 3, TRUE)
  expect_equal(actual, expected)
})

Needed test:

patrick::with_parameters_test_that("Selection of the final series works",
  {
    df <- readRDS("test-data/scores_df_full.rds")
    expected <- readRDS(file.path("test-data", paste0("final_series", mode, ".rds")))
    n <- 3

    actual <- find_final_series(df, n, mode)
    if (mode == TRUE) {
      expect_equal(nrow(actual), 10)
   } else {
      expect_true(nrow(actual), n)
  }
  expect_equal(actual, expected)
  },
  mode = c(TRUE, FALSE)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants