diff --git a/tests/testthat/test-find_weights.R b/tests/testthat/test-find_weights.R index dd010acf9..03da140e2 100644 --- a/tests/testthat/test-find_weights.R +++ b/tests/testthat/test-find_weights.R @@ -2,14 +2,16 @@ skip_if_not_installed("lme4") test_that("find_weights", { data(mtcars) - mtcars$weight <- rnorm(nrow(mtcars), 1, 0.3) + set.seed(123) + mtcars$weight <- abs(rnorm(nrow(mtcars), 1, 0.3)) m <- lm(mpg ~ wt + cyl + vs, data = mtcars, weights = weight) expect_identical(find_weights(m), "weight") }) test_that("find_weights", { data(iris) - iris$wgt <- rnorm(nrow(iris), 1, 0.3) + set.seed(123) + iris$wgt <- abs(rnorm(nrow(iris), 1, 0.3)) m <- lme4::lmer(Sepal.Width ~ Sepal.Length + (1 | Species), data = iris, weights = wgt) expect_identical(find_weights(m), "wgt") })