Project Context
I've got an ASP.NET MVC 5 and ASP.NET Web API 2.0 combined web application (i.e. both in the same project). There are pages that I have created where I do custom SPA: Handlebars.js for html templating, Routie.js for hash routing, and the rest custom JavaScript.
How do I go about unit testing my client-side javascript?
I could write functions that I manually kick off that does the action and checks if it succeeded. This has worked for me, but is still very manual. Any searches for how to automate testing of this code leads me to things like jest.js and such which seem to require npm, which to my understanding requires a node.js project.
I explored the node.js project route a little bit and got jest working for tests, but still lacked the understanding of how to use this project to test my client-side javascript and/or reference the code from the main project.
Question
How do I go about unit testing (preferably automating such tests; e.g. Azure DevOps) in an ASP.NET MVC 5 / Web Api 2.0 project?
If I need to create a node.js project with a test runner like Jest, how do I reference my client-side code from the main project to be tested?
I conceptually know how to write tests, I'm just running into problems understanding how to get the environment setup to do so. I have my C# unit tests setup to automatically run with my Azure DevOps pipeline, I'm just missing on how to get something setup to test my client-side JavaScript.