@@ -57,6 +57,47 @@ test('Test typeahead with mock', () => {
57
57
} ) ;
58
58
} ) ;
59
59
60
+ test ( 'Test spellcheck with mock' , ( ) => {
61
+ const client = Client ( ) ;
62
+ const term = 'evergrand stok' ;
63
+ return client . spellcheck ( {
64
+ q : term ,
65
+ } ) . then ( ( response ) => {
66
+ expect ( response . config . params . q ) . toBe ( term ) ;
67
+ expect ( response . config . url ) . toBe ( '/spellcheck' ) ;
68
+ expect ( response . config . method ) . toBe ( 'get' ) ;
69
+ expect ( response . data . tokens . length > 0 ) . toBe ( true ) ;
70
+ } ) . catch ( ( ) => {
71
+ fail ( 'Failed!' ) ;
72
+ } ) ;
73
+ } ) ;
74
+
75
+ test ( 'Test related searches with mock' , ( ) => {
76
+ const client = Client ( ) ;
77
+ const term = 'evergrande' ;
78
+ return client . fetchRelatedSearches ( {
79
+ q : term ,
80
+ } ) . then ( ( response ) => {
81
+ expect ( response . config . params . q ) . toBe ( term ) ;
82
+ expect ( response . config . url ) . toBe ( '/related_searches' ) ;
83
+ expect ( response . config . method ) . toBe ( 'get' ) ;
84
+ expect ( response . data . terms . length > 0 ) . toBe ( true ) ;
85
+ } ) . catch ( ( e ) => {
86
+ fail ( 'Failed!' ) ;
87
+ } ) ;
88
+ } ) ;
89
+
90
+ test ( 'Test trending searches with mock' , ( ) => {
91
+ const client = Client ( ) ;
92
+ return client . fetchTrendingSearches ( ) . then ( ( response ) => {
93
+ expect ( response . config . url ) . toBe ( '/trending_searches' ) ;
94
+ expect ( response . config . method ) . toBe ( 'get' ) ;
95
+ expect ( response . data . terms . length > 0 ) . toBe ( true ) ;
96
+ } ) . catch ( ( ) => {
97
+ fail ( 'Failed!' ) ;
98
+ } ) ;
99
+ } ) ;
100
+
60
101
test ( 'Test fetchBestPodcasts with mock' , ( ) => {
61
102
const client = Client ( ) ;
62
103
const genreId = 123 ;
0 commit comments