tests/testthat/test-check.R

context("Scorecard transaction check")

test_that("Check without scorecard invalid", {
  rv <- scorecard_check()
  expect_false(rv$valid)

  rv <- scorecard_check(NA)
  expect_false(rv$valid)
})

test_that("Check without transactions invalid", {
  sf <- "testdata/scorecard.yml"
  rv <- scorecard_check(sf)
  expect_false(rv$valid)

  rv <- scorecard_check(sf,NA)
  expect_false(rv$valid)
})

test_that("Check with bogus files invalid",{
  sf <- "testdata/scorecard.yml"
  tf <- "testdata/missing.csv"
  rv <- scorecard_check(sf,NA)
  expect_false(rv$valid)

  rv <- scorecard_check(sf,tf)
  expect_false(rv$valid)
})

test_that("Check with proper file valid",{
  sf <- "testdata/scorecard.yml"
  tf <- "testdata/transactions.csv"
  rv <- scorecard_check(sf,tf)
  #print(rv)
  #print(str(rv))
  expect_true(rv$valid)
})
greatgray/scorecard documentation built on May 17, 2019, 8:34 a.m.