test_that("returns a plot", { mock_data <- data.frame( seqnames=c("chr2L","chr2L","chr2L","chr2L","chr2L","chr2L","chr2L","chr2L","chr2L","chr2L"), start=c(1,100001,200001,300001,400001,500001,600001,700001,800001,900001), end=c(100000,200000,300000,400000,500000,600000,700000,800000,900000,1000000), width=c(100000,100000,100000,100000,100000,100000,100000,100000,100000,100000), strand=c("*","*","*","*","*","*","*","*","*","*"), name=c(1,2,3,4,5,6,7,8,9,10), sum_sim_deltaF=c(-0.4375,-2.325,-1.5125,-1.4,-0.05,-0.4,-0.7375,-2.0125,-1.625,0.1), sum_sec_deltaF=c(137.77778,210.85556,101.85556,192.51666,156.78334,93.23889,87.58889,72.60556,102.44445,55.29444), sum_simward_AFshift=c(-68.67014,-104.26528,-50.17153,-95.55833,-78.36667,-46.41944,-43.42569,-35.29653,-50.40973,-27.69722), max_simward_AFshift=c(0.7131222,0.7267438,0.7919494,0.7412333,0.7720833,0.7466139,0.7801472,0.7760338,0.7533477,0.7891506), min_simward_AFshift=c(-0.2868778,-0.2732562,-0.2080506,-0.2587667,-0.2279167,-0.2533861,-0.2198528,-0.2239662,-0.2466523,-0.2108494), sim_sec_difference=c(0.5138115,0.4737346,0.3367038,0.4584318,0.3920833,0.3869376,0.3790832,0.3376383,0.4146193,0.3999597), num_snp=c(269,450,307,423,400,242,233,221,251,138), avg_sim_deltaF=c(-0.0016263941,-0.0051666667,-0.0049267101,-0.0033096927,-0.000125,-0.0016528926,-0.0031652361,-0.0091063348,-0.0064741036,0.0007246377), avg_sec_deltaF=c(0.5121851,0.4685679,0.3317771,0.4551221,0.3919583,0.3852847,0.375918,0.328532,0.4081452,0.4006844), avg_simward_AFshift=c(-0.2552793,-0.2317006,-0.1634252,-0.2259062,-0.1959167,-0.1918159,-0.1863764,-0.1597128,-0.2008356,-0.2007045), win=c(1,2,3,4,5,6,7,8,9,10)) %>% GenomicRanges::GRanges() expect_no_error( mock.plot <- windowedFrequencyShift.plotter(mock_data)) expect_true(ggplot2::is.ggplot(mock.plot@ggplot)) }) # to do : beef this up with vdiffr : https://github.com/r-lib/vdiffr