Anon message board testing

Hello!

I naturally don’t ask a lot of questions, so I want to get better at this. While I started creating the first test for the message board project, I noticed that it kept timing out. I found that it was because I was doing 14 rounds of hashing for the delete password. I changed to 12 rounds, and it works most of the time, but surely this can’t be optimal to lessen security to pass a test?

I searched for ways to lengthen the time for Chai, but only received results for Mocha. Does anyone know of a better route?

12 is afaik the standard default nowadays if you’re talking about bcrypt (should take ~250ms to compute on modern systems).

But that aside, the tests shouldn’t have to ever be affected by passwords anyway: you shouldn’t ever need to authorise for a unit test. It’s only e2e/integration tests where that comes into play, and for that you would use something like Puppeteer or Selenium. But if you are doing this:

Mocha is the test runner, the program that runs a set of tests, and its API gives you a set of functions to allow it to do that (eg describe, it, before after). Chai is just a set of helper functions (assertions) that check something is/is not something else in something like plain English, like expect(foo).to.equal(bar), so you use those instead of writing foo === bar.

The answers are for Mocha, not Chai, because Mocha is the thing you are using to run the tests, not Chai