deno.land / x / google_play_scraper@v10.0.0 / test / common.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
import { assert } from 'chai';import validator from 'validator';
function assertValidUrl (url) { return assert(validator.isURL(url, { allow_protocol_relative_urls: true }), `${url} is not a valid url`);}
function assertValidApp (app) { assert.isString(app.appId); assert.isString(app.title); assert.isString(app.summary); assertValidUrl(app.url); assertValidUrl(app.icon);
if (app.score !== undefined) { // would fail for new apps without score assert.isNumber(app.score); assert(app.score >= 0); assert(app.score <= 5); }
assert.isBoolean(app.free);
// FIXME this is only allowed for preregister, check for that when field is available if (app.priceText !== undefined) { assert.isString(app.priceText); }
return app;}
function assertIdsInArray (apps, ...ids) { assert.isTrue(ids.every((id) => apps.some((app) => app.appId === id)));}
export { assertValidUrl, assertValidApp, assertIdsInArray };
google_play_scraper

Version Info

Tagged at
9 months ago