File tree Expand file tree Collapse file tree 2 files changed +81
-0
lines changed Expand file tree Collapse file tree 2 files changed +81
-0
lines changed Original file line number Diff line number Diff line change 1+ library(testthat )
2+ library(searcher )
3+
4+ test_check(" searcher" )
Original file line number Diff line number Diff line change 1+ context(" searcher" )
2+
3+ test_that(" Check link generation" , {
4+
5+ # #### Google
6+
7+ expect_identical(
8+ search_google(" toad" ),
9+ " https://google.com/search?q=toad"
10+ )
11+
12+ # #### Bing
13+
14+ expect_identical(
15+ search_bing(" toad" ),
16+ " https://bing.com/search?q=toad"
17+ )
18+
19+ # #### DDG
20+
21+ expect_identical(
22+ search_duckduckgo(" toad" ),
23+ " https://duckduckgo.com/?q=toad"
24+ )
25+
26+ # #### StackOverflow
27+
28+ expect_identical(
29+ search_stackoverflow(" toad" ),
30+ " https://stackoverflow.com/search?q=toad%20[r]"
31+ )
32+
33+ expect_identical(
34+ search_stackoverflow(" toad" , rlang = FALSE ),
35+ " https://stackoverflow.com/search?q=toad"
36+ )
37+
38+ # #### GitHub
39+
40+ expect_identical(
41+ search_github(" toad" ),
42+ " https://github.com/search?q=toad%20language:r%20type:issue&type=Issues"
43+ )
44+
45+ expect_identical(
46+ search_github(" toad" , rlang = FALSE ),
47+ " https://github.com/search?q=toad&type=Issues"
48+ )
49+
50+ # #### BitBucket
51+
52+ expect_identical(
53+ search_bitbucket(" toad" ),
54+ " https://bitbucket.com/search?q=toad%20lang:r"
55+ )
56+
57+ expect_identical(
58+ search_bitbucket(" toad" , rlang = FALSE ),
59+ " https://bitbucket.com/search?q=toad"
60+ )
61+
62+ })
63+
64+
65+ test_that(" Malformed search query validation" , {
66+ expect_identical(
67+ search_google(" " ),
68+ " " ,
69+ " Empty string check if no error messages"
70+ )
71+
72+ expect_identical(
73+ search_google(NULL ),
74+ " " ,
75+ " NULL value handling"
76+ )
77+ })
You can’t perform that action at this time.
0 commit comments