Sign Up Now!

Sign up and get personalized intelligence briefing delivered daily.

Sign Up

Articles related to "factory"

TDD course with AdonisJs - 9. Cleaning up after ourselves

  • Let's refactor our functional threads test a little.
  • In fact let's take all the tests the belongs to creating a thread into a dedicated create-thread.spec.js.
  • Next, highlight all the code starting from the test authorized user can create threads until the one we just moved up.
  • You can now rename that new file to create-thread.spec.js.
  • Finally copy over the meta stuff from thread.spec.js at the top of the file.
  • Let's extract them to a dedicated read-thread.spec.js.
  • Don't forget that because of this, every file also needs to require the Factory.
  • While global variables are usually considered bad, they can be really useful in scenarios like this, making writing tests with Adonis even simpler.
  • This will now create a new file inside the repository so every member in the team can make use of the snippet.

save | comments | report | share on