I’d done some work on a function last week that determined if a certain permission level was valid for a particular type of user account in our app. The requirements depended on multiple different factors including account type, language, and some other sub data types. I paired with some other devs on the team because they knew way more about the account types than I did, yes, they were convoluted and a few special cases had to be accounted for and even included a check for language spoken and region of a country.
This function had been a lot more straight forward but we were expanding the application to work with more account types so the unit test requirements doubled. When I went to update them I was struggling a bit, remember, I’m using TypeScript and I’m still really bad at it.
After scratching my head for a bit I opened Cline in Visual Studio Code and asked it to “write unit tests for [filename].ts” and it got to to work. It churned away for a while then started outputting new code. After checking some outputs and clicking Save a few times my brand new unit tests were complete.
It worked. Color me shocked. 😳
I can now see doing this for most, if not all, of my unit test needs on this project and probably others. As much as I enjoy writing unit tests, no, seriously, I do enjoy it, this saved me quite a bit of time. Just incredible.