deno.land / x / google_play_scraper@v10.0.0 / test / lib.search.js

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import { assert } from 'chai';import gplay from '../index.js';import { assertValidApp, assertIdsInArray } from './common.js';
describe('Search method', () => { it('should fetch a valid application list', () => { return gplay.search({ term: 'Panda vs Zombies' }) .then((apps) => apps.map(assertValidApp)); });
it('should validate the results number', function () { const count = 5; return gplay.search({ term: 'vr', num: count }) .then((apps) => { apps.map(assertValidApp); assert(apps.length === count, `should return ${count} items but ${apps.length} returned`); }); });
// preregister tend to have some fields missing, increasing chances of failure // by searching "preregister" we have more chances of getting some in the results it('should search for pre register', () => gplay.search({ term: 'preregister', num: 10 }) .then((apps) => apps.map(assertValidApp)));
it('should search for pre register with fullDetail', () => gplay.search({ term: 'preregister', num: 10, fullDetail: true }) .then((apps) => apps.map(assertValidApp))).timeout(5 * 1000);
it('should fetch multiple pages of distinct results', () => gplay.search({ term: 'p', num: 55 }) .then((apps) => { assert.equal(apps.length, 55, 'should return as many apps as requested'); }));
it('should fetch multiple pages of when not starting from cluster of subsections', () => gplay.search({ term: 'p', num: 65 }) .then((apps) => { assert.equal(apps.length, 65, 'should return as many apps as requested'); }));
describe('country and language specific', () => { describe('without more results section', () => { it('should fetch a valid application list for eu country', () => { return gplay.search({ term: 'Panda vs Zombies', country: 'GH' }) .then((apps) => apps.map(assertValidApp)); });
it('should fetch a valid application list for non eu country', () => { return gplay.search({ term: 'Facebook', country: 'GE' }) .then((apps) => apps.map(assertValidApp)); });
it('should fetch a valid application list for eu country with specific language', () => { return gplay.search({ term: 'Panda vs Zombies', country: 'BE', lang: 'it' }) .then((apps) => apps.map(assertValidApp)); }); }); });
describe('more results mapping', () => { it('should return few netflix apps', () => { return gplay.search({ term: 'netflix' }) .then((apps) => { assert.equal(apps[0].appId, 'com.netflix.mediaclient'); assert.isAbove(apps.length, 0); }); });
it('should return few netflix apps from german store with german language', () => { return gplay.search({ term: 'netflix', lang: 'de', country: 'DE' }) .then((apps) => { assert.equal(apps[0].appId, 'com.netflix.mediaclient'); // Don't check specific ids, as results may vary assert.isAbove(apps.length, 1); }); });
it('should return few google mail apps', () => { return gplay.search({ term: 'gmail' }) .then((apps) => { assert.equal(apps[0].appId, 'com.google.android.gm'); assert.isTrue(apps.some((app) => app.appId === 'com.google.android.gm.lite')); }); });
it('should return apps for search with a category as query', () => { return gplay.search({ term: 'games' }) .then((apps) => assertIdsInArray(apps, 'com.kiloo.subwaysurf')); });
it('should return empty set when no results found', () => { return gplay.search({ term: 'asdasdyxcnmjysalsaflaslf' }) .then(assert.isEmpty); });
it('should return empty set when no results found in eu country store', () => { return gplay.search({ term: 'ASyyDASDyyASDASD', country: 'DE', lang: 'SP' }) .then(assert.isEmpty); });
it('should return empty set when no results found in us store with other language', () => { return gplay.search({ term: 'ASyyDASDyyASDASD', country: 'US', lang: 'FR' }) .then(assert.isEmpty); }); });
describe('suggested search', () => { it('should return apps from suggested search', () => { return gplay.search({ term: 'runing app' }) .then((apps) => { apps.map(assertValidApp); assertIdsInArray(apps, 'com.runtastic.android', 'running.tracker.gps.map', 'com.google.android.apps.fitness'); }); });
it('should return apps from suggested search in european country', () => { return gplay.search({ term: 'runing tracker', country: 'GR' }) .then((apps) => { apps.map(assertValidApp); assertIdsInArray(apps, 'com.runtastic.android', 'running.tracker.gps.map'); }); }); });});
google_play_scraper

Version Info

Tagged at
9 months ago