Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add preregister, earlyAccessEnabled, androidMaxVersion, originalPrice and discountEndDate properties #648

Merged
merged 28 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6bda416
Fixed code and unit tests
jbigman Jul 26, 2023
ccb3bb4
Bump semver from 6.3.0 to 6.3.1 and word-wrap from 1.2.3 to 1.2.4
jbigman Jul 26, 2023
afca862
String optimisation
jbigman Jul 26, 2023
32c4b00
Use https://yesno.wtf/api for throttle tests
jbigman Jul 26, 2023
3c9ba74
Set timeout to 18000ms: (3 times 5000ms + margin)
jbigman Jul 26, 2023
e6467c4
Set timeout to 30000ms: because we can't ensure called rest services…
jbigman Jul 26, 2023
e49ac11
Rerun checks
jbigman Jul 26, 2023
f09e537
Create main.yml
jbigman Jul 27, 2023
505b4ef
Added logs to understand why check fails
jbigman Jul 27, 2023
4cdf2b3
Added logs to understand why check fails
jbigman Jul 27, 2023
9f098cc
Removed logs
jbigman Jul 27, 2023
378a71f
Updated expected result for more reliable ones
jbigman Jul 27, 2023
74cd435
39aaa8a9(Node version 12.x and 14.x are not supported anymore: https:…
jbigman Jul 28, 2023
b7dfebd
Updated should return apps from suggested search in european country …
jbigman Jul 28, 2023
86395bf
Updated assertions "search with german language"
jbigman Jul 28, 2023
2b40f86
Merge branch 'facundoolano:main' into main
jbigman Aug 2, 2023
880a004
Added back preregister property and added earlyAccessEnabled
jbigman Aug 2, 2023
9f54194
Added androidMaxVersion property
jbigman Aug 3, 2023
ceeeebe
Added originalPrice and discountEndDate properties
jbigman Aug 3, 2023
93ce5df
Fixed throttle tests (add mocks and updated expected results)
jbigman Aug 3, 2023
c336f83
Fixed eslint eol-last
jbigman Aug 3, 2023
55d435f
Fixed gmail search assertions
jbigman Aug 3, 2023
3364f8a
Moved sinon in dev dependencies, updated throttle tests with a 1000ms…
jbigman Aug 3, 2023
73d3732
Fixed eslint
jbigman Aug 3, 2023
f16c23a
Moved sinon in dev dependencies, updated throttle tests with a 1000ms…
jbigman Aug 3, 2023
d944ed0
Updated throttle to 2000ms interval and assertions checks results +/-…
jbigman Aug 3, 2023
1074d94
Merge branch 'Fix-throttle-tests' into add-properties
jbigman Aug 4, 2023
529defc
Merge remote-tracking branch 'upstream/main' into add-properties
jbigman Aug 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Results:
size: 'Varies with device',
androidVersion: 'VARY',
androidVersionText: 'Varies with device',
androidMaxVersion: 'VARY',
developer: 'Google LLC',
developerId: '5700313618786177705',
developerEmail: '[email protected]',
Expand Down Expand Up @@ -96,6 +97,9 @@ Results:
version: 'Varies with device',
recentChanges: 'Improved offline translations with upgraded language downloads',
comments: [],
preregister: false,
earlyAccessEnabled: false,
isAvailableInPlayPass: false,
editorsChoice: true,
features: [
{
Expand Down
18 changes: 18 additions & 0 deletions lib/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ const MAPPINGS = {
path: ['ds:5', 1, 2, 57, 0, 0, 0, 0, 1, 0, 0],
fun: (val) => val / 1000000 || 0
},
// If there is a discount, originalPrice if filled.
originalPrice: {
path: ['ds:5', 1, 2, 57, 0, 0, 0, 0, 1, 1, 0],
fun: (price) => price ? price / 1000000 : undefined
},
discountEndDate: ['ds:5', 1, 2, 57, 0, 0, 0, 0, 14, 1],
free: {
path: ['ds:5', 1, 2, 57, 0, 0, 0, 0, 1, 0, 0],
// considered free only if price is exactly zero
Expand Down Expand Up @@ -94,6 +100,10 @@ const MAPPINGS = {
path: ['ds:5', 1, 2, 140, 1, 1, 0, 0, 1],
fun: (version) => version || 'Varies with device'
},
androidMaxVersion: {
path: ['ds:5', 1, 2, 140, 1, 1, 0, 1, 1],
fun: helper.normalizeAndroidVersion
},
developer: ['ds:5', 1, 2, 68, 0],
developerId: {
path: ['ds:5', 1, 2, 68, 1, 4, 2],
Expand Down Expand Up @@ -156,6 +166,14 @@ const MAPPINGS = {
isArray: true,
fun: helper.extractComments
},
preregister: {
path: ['ds:5', 1, 2, 18, 0],
fun: (val) => val === 1
},
earlyAccessEnabled: {
path: ['ds:5', 1, 2, 18, 2],
fun: (val) => typeof val === 'string'
},
isAvailableInPlayPass: {
path: ['ds:5', 1, 2, 62],
fun: (field) => !!field
Expand Down
14 changes: 13 additions & 1 deletion test/lib.app.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,18 @@ const validateAppDetails = (app) => {
assert.isString(app.contentRating);

assert.equal(app.androidVersion, '7.0');
assert.equal(app.androidMaxVersion, 'VARY');

assert.isBoolean(app.available);
assert.equal(app.priceText, 'Free');
assert.equal(app.price, 0);
assert.isTrue(app.free);
assert.isTrue(app.offersIAP);
assert.isString(app.IAPRange);
// assert(app.preregister === false);
assert.isFalse(app.preregister);
assert.isFalse(app.earlyAccessEnabled);
assert.isUndefined(app.originalPrice);
assert.isUndefined(app.discountEndDate);

assert.equal(app.developer, 'Jam City, Inc.');
assert.equal(app.developerId, '5509190841173705883');
Expand Down Expand Up @@ -195,4 +199,12 @@ describe('App method', () => {
assert.equal(app.available, false);
});
});

it('should fetch android version limit set for some old apps', () => {
return gplay.app({ appId: 'air.com.zinkia.playset' })
.then((app) => {
assert.equal(app.androidVersion, '4.2');
assert.equal(app.androidMaxVersion, '7.1.1');
});
});
});