JamesLongman / Squad-Mortar-Calculator-IOS

IOS App: Mortar calculator for the video game Squad
https://itunes.apple.com/app/id1352781413
MIT License
3 stars 0 forks source link

Expand tests: If it can be tested it should be tested #35

Open JamesLongman opened 6 years ago

JamesLongman commented 6 years ago

While working on #5 adding initial tests for the project I have come across several functions that are not of the form function (input) { code; return result}, instead most of the offending code is of the form function(input) {code; someOtherClassOrObject.resultingAction() }. The lack of return makes testing difficult and often requiring the use of stubs. Upon a quick search I haven't found any source that simply explains stubbing in swift so for now I am going to add all code requiring tests through this method here.

It would be possible and indeed easier to test a lot of these functions by returning and I have done this in the past whilst writing tests for a node project; but performance is a huge concern with an IOS project and compromising performance would go against the very reason for introducing tests in the first place which is to help ensure a better final project.

This issue will remain open until either tests are added or points can be proved untestable (personally I think this is unlikely) but this is low priority

Currently tracked files marked with TODOs where tests are needed, search project for #35 to find comments

JamesLongman commented 6 years ago

Branch is actually up for this issue with some work done. Mildly blocked by #6 as I wanted to remove LTMorphingLabel from the project and use a vanilla animation instead. Probably also worth taking a look at the coverage and excluding tests and podfiles from weighing in on the calculation