tests/testthat/test-NPS.R

context("NPS")

set.seed(10)
scores <- sample(0:10, 100, replace = TRUE)

test_that("the correct NPS is calculated", {
  expect_equal(calc_nps(scores), -29)

})

test_that("the correct standard error is calculated", {
  expect_equal(round(calc_nps_std_error(scores), 6), 8.519977)
})
NateByers/IUHhelpers documentation built on Feb. 25, 2020, 8:43 p.m.