Now that we have the user creation flow tested, let's test if that user can log in.
Following the test file pattern we have been using, you need to create a file under test/session.js
with the following content:
First, import the missing dependencies:
var assert = require('assert'), Browser = require('zombie'), app = require('../app'), couchdb = require('../lib/couchdb'), dbName = 'users', db = couchdb.use(dbName), fixtures = require('./fixtures'); describe('Session', function() { before(function(done) { app.start(3000, done); }); after(function(done) { app.server.close(done); });
That concludes the opening ceremonies!
Now we are ready to start describing the login form:
describe('Log in form', function() { before(function(done) { db.get(fixtures.user.email, function(err, doc) { if (err && err.status_code === 404) { return db.insert(fixtures.user, fixtures.user.email, done); ...