Skip to content
This repository has been archived by the owner on Mar 10, 2022. It is now read-only.

Add tests #6

Closed
12 tasks done
mariusc opened this issue Mar 10, 2016 · 6 comments
Closed
12 tasks done

Add tests #6

mariusc opened this issue Mar 10, 2016 · 6 comments

Comments

@mariusc
Copy link
Contributor

mariusc commented Mar 10, 2016

  • tests for NOCache (renamed to Cashier)
    • test object insertion in cache
    • test object fetching from cache
    • test object deletion from cache
    • test cache clearing
    • test image insertion in cache
    • test image deletion from cache
    • test image fetching from cache
    • test cache is automatically cleared on memory warning
    • test cache persistence across versions
    • test cache lifespan
  • tests for NOPersistentStore

Working on branch https://github.com/nodes-ios/Cashier/tree/mariusc-tests for Cashier tests

@mariusc mariusc self-assigned this Mar 11, 2016
@mariusc
Copy link
Contributor Author

mariusc commented Mar 12, 2016

I'm not really sure how to test the cache persistence across versions. Looks like I would need to simulate a change in the CFBundleShortVersionString, and I don't know how to do that. @nodes-ios/developer-team any suggestions on this one?

@dominik-hadl
Copy link
Contributor

Look at how the cache compares versions. I think you should be able to manually change that in NSUserDefaults, so you could make the cache think there's new version :)

@mariusc
Copy link
Contributor Author

mariusc commented Mar 12, 2016

I made the change manually in NSUserDefaults, but my test failed. So I investigated a bit more and saw that [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"] is nil and [[NSBundle mainBundle] infoDictionary] is an empty dictionary.

image.

@dominik-hadl
Copy link
Contributor

That is most likely because of the tests bundle. As a quick hack, swizzling the infoDictionary getter method of NSBundle with a custom implementation would work. Then you can easily control version numbers returned from your custom infoDictionary.

@mariusc
Copy link
Contributor Author

mariusc commented Mar 14, 2016

Made PR for Cashier tests #13. NOPersistentStore ignored for the moment

@mariusc mariusc removed their assignment Mar 16, 2016
@mariusc
Copy link
Contributor Author

mariusc commented Jan 23, 2017

We have added some tests for NOPersistentStore in the Swift types tests. As always, tests can always be improved. But it's safe to close this issue now.

@mariusc mariusc closed this as completed Jan 23, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants