@@ -9,16 +9,40 @@ test_that("get_species_itis with null itis", {
99 expect_true(" ITIS" %in% colnames(res ))
1010 expect_true(" StockName" %in% colnames(res ))
1111 expect_true(" Jurisdiction" %in% colnames(res ))
12+ expect_true(" StockID" %in% colnames(res ))
1213})
1314
15+ # test stock id
16+ test_that(" get_species_itis with character stock id" , {
17+ res <- get_species_itis(stock = " 10950" )
18+ expect_true(nrow(res ) > 0 )
19+ expect_true(any(res $ ITIS == 172419 ))
20+ expect_true(" ITIS" %in% colnames(res ))
21+ expect_true(" StockName" %in% colnames(res ))
22+ expect_true(" Jurisdiction" %in% colnames(res ))
23+ expect_true(" StockID" %in% colnames(res ))
24+ })
25+
26+ test_that(" get_species_itis with numeric stock id" , {
27+ res <- get_species_itis(stock = 10950 )
28+ expect_true(nrow(res ) > 0 )
29+ expect_true(any(res $ ITIS == 172419 ))
30+ expect_true(" ITIS" %in% colnames(res ))
31+ expect_true(" StockName" %in% colnames(res ))
32+ expect_true(" Jurisdiction" %in% colnames(res ))
33+ expect_true(" StockID" %in% colnames(res ))
34+ })
35+
36+
1437# test null stock
1538test_that(" get_species_itis with specific itis" , {
1639 res <- get_species_itis(itis = 172419 )
1740 expect_true(nrow(res ) > 0 )
18- expect_true(all(grepl(" Albacore" ,res $ StockName )))
41+ expect_true(all(grepl(" Albacore" , res $ StockName )))
1942 expect_true(" ITIS" %in% colnames(res ))
2043 expect_true(" StockName" %in% colnames(res ))
2144 expect_true(" Jurisdiction" %in% colnames(res ))
45+ expect_true(" StockID" %in% colnames(res ))
2246})
2347
2448# test null both argument
0 commit comments