forked from RevenueCat/purchases-flutter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentitlement_info_test.dart
52 lines (48 loc) · 1.8 KB
/
entitlement_info_test.dart
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
import 'package:purchases_flutter/entitlement_info_wrapper.dart';
import 'package:test/test.dart';
void main() {
test('unknown period if missing from json', () {
Map<dynamic, dynamic> entitlementInfoJson = {
"identifier": "almost_pro",
"isActive": true,
"willRenew": true,
"latestPurchaseDateMillis": 1.58759855E9,
"latestPurchaseDate": "2020-04-22T23:35:50.000Z",
"originalPurchaseDateMillis": 1.591725245E9,
"originalPurchaseDate": "2020-06-09T17:54:05.000Z",
"expirationDateMillis": null,
"expirationDate": null,
"store": "PLAY_STORE",
"productIdentifier": "consumable",
"isSandbox": true,
"unsubscribeDetectedAt": null,
"unsubscribeDetectedAtMillis": null,
"billingIssueDetectedAt": null,
"billingIssueDetectedAtMillis": null
};
final entitlementInfo = EntitlementInfo.fromJson(entitlementInfoJson);
expect(entitlementInfo.periodType, PeriodType.unknown);
});
test('unknown store if missing from json', () {
Map<dynamic, dynamic> entitlementInfoJson = {
"identifier": "almost_pro",
"isActive": true,
"willRenew": true,
"periodType": "NORMAL",
"latestPurchaseDateMillis": 1.58759855E9,
"latestPurchaseDate": "2020-04-22T23:35:50.000Z",
"originalPurchaseDateMillis": 1.591725245E9,
"originalPurchaseDate": "2020-06-09T17:54:05.000Z",
"expirationDateMillis": null,
"expirationDate": null,
"productIdentifier": "consumable",
"isSandbox": true,
"unsubscribeDetectedAt": null,
"unsubscribeDetectedAtMillis": null,
"billingIssueDetectedAt": null,
"billingIssueDetectedAtMillis": null
};
final entitlementInfo = EntitlementInfo.fromJson(entitlementInfoJson);
expect(entitlementInfo.store, Store.unknownStore);
});
}