ActiveLogin.Identity icon indicating copy to clipboard operation
ActiveLogin.Identity copied to clipboard

Add tests for InvididualIdentityNumber

Open viktorvan opened this issue 6 years ago • 1 comments

Right now all the unit tests are at the level of SwedishPersonalIdentityNumber and SwedishCoordinationNumber. I think we have full coverage of the parsing/validation-logic from there, but we should add just a few tests for the IndividualIdentityNumber wrapper as well.

viktorvan avatar Nov 24 '19 09:11 viktorvan

I am struggling a bit with adding these tests. In most cases I just what to verify that IndividualIdentityNumbers calls the corresponding functions for PersonalIdentityNumber or CoordinationNumber.

One approach is to duplicate all tests for PersonalIdentityNumbers and CoordinationNumbers, and run the through the IndividualIdentityNumber api. But this means we double the amount of tests we need to maintain. And any change to Pin- or CoordNum-tests must be fixed for IndividualIdentityNumber-tests as well. There could be some way to parameterize the tests but I don't think it would make for very readable code.

So my idea is to just add some "smoke tests" that shows that if we can parse 1 PersonalIdentityNumber, and 1 Coordination number as an IndividualIdentityNumber, then we assume everything is hooked up correctly. Since we have extensive tests for Pins and CoordNums I do not want to repeat that logic in the tests for the IndividualIdentityNumbers.

Thoughts on this @PeterOrneholm, or maybe there is an better idea that I just haven't thought of?

viktorvan avatar May 10 '20 15:05 viktorvan