OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Mocha Unit testing

  • Thread starter Thread starter ejb1004
  • Start date Start date
E

ejb1004

Guest
So I'm trying to make a series of unit tests for a project in class. Unfortunately I can't copy a lot of code due to plagiarism issues. So I'll try to explain the problem. We are running unit tests using Mocha and Chai on a calculator app and I'm not sure how to test the functions. They use form.display.value in the functions to get user input from the calculator buttons being pressed but I'm having issues taking the input and using it in my test cases.

I wanted to try to use document.myForm.name_of_form but I now realize you cannot access the document in command line unit testing/with node. So I'm not quite sure how to access that form.display.value data from the calculator functions to run tests. Sorry if this is not enough info but if anybody has any ideas, would love some help! Thank you!

<p>So I'm trying to make a series of unit tests for a project in class. Unfortunately I can't copy a lot of code due to plagiarism issues. So I'll try to explain the problem. We are running unit tests using Mocha and Chai on a calculator app and I'm not sure how to test the functions. They use form.display.value in the functions to get user input from the calculator buttons being pressed but I'm having issues taking the input and using it in my test cases.</p>
<p>I wanted to try to use document.myForm.name_of_form but I now realize you cannot access the document in command line unit testing/with node. So I'm not quite sure how to access that form.display.value data from the calculator functions to run tests. Sorry if this is not enough info but if anybody has any ideas, would love some help!
Thank you!</p>
 

Latest posts

Top