javascript - How to write test driven programming in node.js? -


Recently node me Presented with packages such as JS and Express, Mongodb and EJS. I have a few questions:

As a learning objective, I have created one who has created, Express, Mangode and EJS. I have all my functions in the file. I have to write test cases of all these functions How can I create a test-driven program with this example?

In my app.js file.

  app.get ('/ login', user login); App.post ('/ login', user.loginSubmit);   

I have to write different routes to render the page and submit it etc. If there are some AJAX requests, then we have a lot of paths in app.js Enter the file when considering the paths of a page Is it like this or need to change my structure?

I recommend you, it is from the same person of expressjs Supports, before hook, later, each and surely it supports async code.

I use it in conjunction with should.js or even chai.js.

A temptation test looks like this, code is from my own trial where I request I'm using SuperEgent.

  This ('requests permission with valid ticket', set function ('content-type', 'app / jason') .set ('authorization', 'barrier' + ACCESSTOKEN Send ({Ticket: Ticket)) .ad (function (rik, ridge) {res.should.have.property ('statusCode'). That.equals (201); var location = ..... res. Headers.should.have.property ('location'). That.is.equal (location); done ();});})    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -