test_that("small-data leave_out_KSS workflow writes expected files", { skip_on_cran() path <- system.file("extdata", "test.csv", package = "LeaveOutKSS") dt <- data.table::fread(path, header = FALSE) out <- tempfile("leaveoutkss_test_") leave_out_KSS( y = dt[[4]], id = dt[[1]], firmid = dt[[2]], simulations_JLA = 5, paral = FALSE, filename = out, print_output = FALSE ) expect_true(file.exists(paste0(out, ".csv"))) expect_true(file.exists(paste0(out, ".txt"))) }) test_that("small-data leave_out_KSS_fe workflow writes expected files", { skip_on_cran() path <- system.file("extdata", "test.csv", package = "LeaveOutKSS") dt <- data.table::fread(path, header = FALSE) out <- tempfile("leaveoutkss_fe_test_") leave_out_KSS_fe( y = dt[[4]], id = dt[[1]], firmid = dt[[2]], controls = cbind(year = dt[[3]]), absorb_col = 1, simulations_JLA = 5, paral = FALSE, filename = out, print_output = FALSE ) expect_true(file.exists(paste0(out, ".csv"))) expect_true(file.exists(paste0(out, ".txt"))) }) test_that("small-data rsquared workflow writes expected log", { path <- system.file("extdata", "test.csv", package = "LeaveOutKSS") dt <- data.table::fread(path, header = FALSE) out <- tempfile("leaveoutkss_r2_test_") rsquared_comp( y = dt[[4]], id = dt[[1]], firmid = dt[[2]], filename = out, print_output = FALSE ) expect_true(file.exists(paste0(out, ".txt"))) })