Wednesday 9 August 2017

Can you critique my attempt at writing an API function and unit test for it?

I'm about to begin developing a huge project, and before I write all the API I want to get some professional feedback and redo things correctly.So right now I try to keep my functions as small as possible "create" "delete" etc. But each function has a bunch of logic inside of it and relies on other data in the database as well as multiple SQL transactions.I read about spies and stubs.. but I can't grasp my head around how I could use them to test my API functions.As of now.. this is how I'm testing..Here's a function called create that creates a team in the database http://ift.tt/2vPmuvS here's the tests for it http://ift.tt/2wIh1DH someone please elaborate a better way I could either be creating my create function or the tests for the create function?Thanks

Submitted August 09, 2017 at 04:27PM by pomeloanthony

No comments:

Post a Comment