Finishing our feature

We are almost done; we just need to finish our last scenario. First of all, we need a new DAO that is responsible for storing the messages. The real implementation of this DAO, perhaps, will not go to the database but will probably use the flash scope or the session scope of the web framework we are going to use. This does not matter conceptually as it is an object to access external data:

beforeEach(function () {
  this.orderStorage = newStorage();
  this.messageStorage = newStorage();
  this.orderSystem = orderSystemWith({
    order: this.orderStorage.dao(),
    message: this.messageStorage.dao()
  });
});

Now, we can create an example message factory in the test/support/examples/errors.js file:

'use strict'; module.exports = { badQuantity: ...

Get Learning Behavior-driven Development with JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.