@@ -12,10 +12,6 @@ @interface TranslatorTest : XCTestCase
1212@property (strong , nonatomic ) NSDictionary *discountMap;
1313@property (strong , nonatomic ) NSDictionary *productMap;
1414@property (strong , nonatomic ) NSDictionary *productResponseMap;
15- @property (strong , nonatomic ) NSDictionary *downloadMap;
16- @property (strong , nonatomic ) NSDictionary *paymentMap;
17- @property (strong , nonatomic ) NSDictionary *transactionMap;
18- @property (strong , nonatomic ) NSDictionary *errorMap;
1915@property (strong , nonatomic ) NSDictionary *localeMap;
2016
2117@end
@@ -46,72 +42,6 @@ - (void)setUp {
4642 };
4743 self.productResponseMap =
4844 @{@" products" : @[ self .productMap ], @" invalidProductIdentifiers" : @[]};
49- self.downloadMap = @{
50- @" state" : @(0 ),
51- @" contentIdentifier" : [NSNull null ],
52- @" contentLength" : @(2 ),
53- @" contentURL" : @" https://flutter.io" ,
54- @" contentVersion" : [NSNull null ],
55- @" error" : [[NSError errorWithDomain: @" test_stub" code: 123 userInfo: @{}] toMap ],
56- @" progress" : @(0.5 ),
57- @" timeRemaining" : @(100 ),
58- @" downloadTimeUnKnown" : @(NO ),
59- @" transactionID" : [NSNull null ],
60- };
61- self.paymentMap = @{
62- @" productIdentifier" : @" 123" ,
63- @" requestData" : @" abcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefgh" ,
64- @" quantity" : @(2 ),
65- @" applicationUsername" : @" app user name" ,
66- @" simulatesAskToBuyInSandbox" : @(NO )
67- };
68- NSDictionary *originalTransactionMap = @{
69- @" transactionIdentifier" : @" 567" ,
70- @" transactionState" : @(SKPaymentTransactionStatePurchasing),
71- @" payment" : [NSNull null ],
72- @" error" : [[NSError errorWithDomain: @" test_stub" code: 123 userInfo: @{}] toMap ],
73- @" transactionTimeStamp" : @([NSDate date ].timeIntervalSince1970 ),
74- @" originalTransaction" : [NSNull null ],
75- @" downloads" : @[ @{
76- @" state" : @(0 ),
77- @" contentIdentifier" : [NSNull null ],
78- @" contentLength" : @(2 ),
79- @" contentURL" : @" https://flutter.io" ,
80- @" contentVersion" : [NSNull null ],
81- @" error" : [[NSError errorWithDomain: @" test_stub" code: 123 userInfo: @{}] toMap ],
82- @" progress" : @(0.5 ),
83- @" timeRemaining" : @(100 ),
84- @" downloadTimeUnKnown" : @(NO ),
85- @" transactionID" : @" 567" ,
86- } ]
87- };
88- self.transactionMap = @{
89- @" transactionIdentifier" : @" 567" ,
90- @" transactionState" : @(SKPaymentTransactionStatePurchasing),
91- @" payment" : [NSNull null ],
92- @" error" : [[NSError errorWithDomain: @" test_stub" code: 123 userInfo: @{}] toMap ],
93- @" transactionTimeStamp" : @([NSDate date ].timeIntervalSince1970 ),
94- @" originalTransaction" : originalTransactionMap,
95- @" downloads" : @[ @{
96- @" state" : @(0 ),
97- @" contentIdentifier" : [NSNull null ],
98- @" contentLength" : @(2 ),
99- @" contentURL" : @" https://flutter.io" ,
100- @" contentVersion" : [NSNull null ],
101- @" error" : [[NSError errorWithDomain: @" test_stub" code: 123 userInfo: @{}] toMap ],
102- @" progress" : @(0.5 ),
103- @" timeRemaining" : @(100 ),
104- @" downloadTimeUnKnown" : @(NO ),
105- @" transactionID" : @" 567" ,
106- } ]
107- };
108- self.errorMap = @{
109- @" code" : @(123 ),
110- @" domain" : @" test_domain" ,
111- @" userInfo" : @{
112- @" key" : @" value" ,
113- }
114- };
11545}
11646
11747- (void )testSKProductSubscriptionPeriodStubToMap {
@@ -140,34 +70,6 @@ - (void)testProductResponseToMap {
14070 XCTAssertEqualObjects (map, self.productResponseMap );
14171}
14272
143- - (void )testDownloadToMap {
144- // bug with state, downloadTimeUnKnown, transaction and contentIdentifer in KVC, cannot test these
145- // fields.
146- SKDownloadStub *download = [[SKDownloadStub alloc ] initWithMap: self .downloadMap];
147- NSDictionary *map = [download toMap ];
148- XCTAssertEqualObjects (map, self.downloadMap );
149- }
150-
151- - (void )testPaymentToMap {
152- SKMutablePayment *payment = [[SKMutablePayment alloc ] initWithMap: self .paymentMap];
153- NSDictionary *map = [payment toMap ];
154- XCTAssertEqualObjects (map, self.paymentMap );
155- }
156-
157- - (void )testPaymentTransactionToMap {
158- // payment is not KVC, cannot test payment field.
159- SKPaymentTransactionStub *paymentTransaction =
160- [[SKPaymentTransactionStub alloc ] initWithMap: self .transactionMap];
161- NSDictionary *map = [paymentTransaction toMap ];
162- XCTAssertEqualObjects (map, self.transactionMap );
163- }
164-
165- - (void )testError {
166- NSErrorStub *error = [[NSErrorStub alloc ] initWithMap: self .errorMap];
167- NSDictionary *map = [error toMap ];
168- XCTAssertEqualObjects (map, self.errorMap );
169- }
170-
17173- (void )testLocaleToMap {
17274 NSLocale *system = NSLocale .systemLocale ;
17375 NSDictionary *map = [system toMap ];
0 commit comments