tests/testthat/test-logid.R

context("Log ID")
test_that("Gets right Ids given a Player", {
  testPlayer <- "[U:1:72806494]" #Herr_p

  logID <- getLogIDsJSON(player = testPlayer, num = 2)
  for(lid in paste0("http://logs.tf/", logID)){
    test <- xml2::read_html(lid)
    expect_false(grepl("Not Found", test))
  }

})

test_that("comp.tf scraping gets Tourney IDs right",{
	logIDs <- getLogIDsComptf("Insomnia52", withNames = FALSE, shReDownload = TRUE)

	expect_equal(length(logIDs), 52)
	expect_true(is.character(logIDs))
})

test_that("comp.tf scraping gets Tourney Names right",{
	logIDs <- getLogIDsComptf("Insomnia52", withNames = TRUE, shReDownload = TRUE)

	expect_equal(length(logIDs), 52)
	expect_true(is.character(logIDs))
	expect_true(any(grepl("Grand", names(logIDs))))
})

test_that("comp.tf scraping gets Season Names right",{
	logIDs <- getLogIDsComptf("ETF2L_6v6_Season_21",
    withNames = TRUE,
    shReDownload = TRUE,
    scrapeLoc = "Season")

  expect_equal(length(logIDs), 60)
	expect_true(is.character(logIDs))
	expect_true(any(nzchar(names(logIDs))))
})
sidjai/tf2statr documentation built on May 29, 2019, 9:59 p.m.