@@ -28,3 +28,18 @@ info <- "plot_ps_metrics2() returns plotting object with expected content"
2828p2 <- plot_ps_metrics2(GlobalPatterns , color = " SampleType" , refdb = " RefSeq_206" , quiet = TRUE )
2929expect_equal(names(p2 $ data )[1 : 2 ], c(" Zc" , " nH2O" ), info = info )
3030expect_equal(dim(p2 $ data ), c(26 , 10 ), info = info )
31+
32+ # 20250321
33+ info <- " plot_ps_metrics() handles 'color' and 'shape' arguments"
34+ p3 <- plot_ps_metrics(GlobalPatterns , x = " SampleType" , color = " SampleType" , sortby = " Zc" , refdb = " RefSeq_206" )
35+ expect_equal(p3 $ labels $ colour , " SampleType" , info = info )
36+ p4 <- plot_ps_metrics(GlobalPatterns , x = " SampleType" , shape = " SampleType" , sortby = " Zc" , refdb = " RefSeq_206" )
37+ expect_equal(p4 $ labels $ shape , " SampleType" , info = info )
38+
39+ info <- " plot_ps_metrics2() stops for too few metrics and warns for too many"
40+ expect_error(plot_ps_metrics2(GlobalPatterns , metrics = c(" Zc" ), color = " SampleType" , refdb = " RefSeq_206" , quiet = TRUE ),
41+ " please supply the names of two metrics" , info = info )
42+ expect_warning(plot_ps_metrics2(GlobalPatterns , metrics = c(" Zc" , " nH2O" , " nO2" ), color = " SampleType" , refdb = " RefSeq_206" , quiet = TRUE ),
43+ " using the first two" , info = info )
44+
45+ dev.off()
0 commit comments