Giter Club home page Giter Club logo

Comments (4)

xavigil avatar xavigil commented on July 28, 2024

I have sent a pull request that checks if an auto-renewable subscription is still valid.

from rmstore.

hpique avatar hpique commented on July 28, 2024

@xgil78 Merged with minor changes. Up to add the unit tests as well? :)

from rmstore.

xavigil avatar xavigil commented on July 28, 2024

I have sent a pull request with one single simple test. Without a valid app receipt I don't really know how to add more tests.

What I suggest is you save a real app receipt as a file with some test purchases in it:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [NSString stringWithFormat:@"%@/%@", documentsDirectory, @"appReceiptForTesting.data"];
[asn1Data writeToFile:filePath atomically:YES];

Then add that file to the test target bundle. After that we can use the file to initialize RMAppReceipt in the tests:

NSBundle *bundle = [NSBundle bundleForClass:[self class]];
NSString *filePath = [bundle pathForResource:@"appReceiptForTesting" ofType:@"data"];
NSData *data = [NSData dataWithContentsOfFile:filePath];
_receipt = [[RMAppReceipt alloc] initWithASN1Data:data];    

I have tried it with my own store products and it works. It should be done with robotmedia test products so anyone can add tests with the same purchased items.

If you like the idea, please add an auto-renewable subscription purchase to your testing app receipt as well.

from rmstore.

hpique avatar hpique commented on July 28, 2024

@xgil78 You can also test code execution of isActiveAutoRenewableSubscriptionForDate:.

Good idea. More than including valid receipts, testing with NSData constants containing the ASN1 part of valid receipts should be enough. I'll give it a go later this week.

from rmstore.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.