tests/testthat/test-util.R

context("util")

library(googlesheets)
library(testthat)

test_that('Get File', {
  skip("Googlesheets is not reachable")
  url <- "https://docs.google.com/spreadsheets/d/1NKCZu41xrWmI0iSDkiRbOp0_BVl4K8xoNq3E0ud7Ea8/edit?usp=sharing"
  s <- getGoogleSheetFromUrl (url)
  expect_equal(nrow(s), 17)
})


test_that('Dollar Conversion',{
 expect_equal(clnDollar("$10.11"),10.11)
})

test_that('Dollar Conversion fail in alphabets are in data',{
  expect_true (is.na( clnDollar("$1A.11")))
  expect_warning(clnDollar("$1A.11"),"NAs introduced by coercion")
})

test_that('Dollar Conversion fail if there is space',{
  expect_true (is.na( clnDollar("$11 .11")))
  expect_warning(clnDollar("$11 .11"),"NAs introduced by coercion")
})

test_that('NA',{
  ls <- c(NA,'Yes')
  expect_equal(checkReconciled(ls),'No')
})

test_that('No',{
  ls <- c('No','Yes')
  expect_equal(checkReconciled(ls),'No')
})

test_that('Yes',{
  ls <- c('Yes','Yes')
  expect_equal(checkReconciled(ls),'Yes')
})
ravi9884/PersonalFinance documentation built on May 4, 2019, 6:38 p.m.