Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Events
Videos
Audiobooks
Packt Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Learning Behavior-driven development with Javascript

You're reading from   Learning Behavior-driven development with Javascript Create powerful yet simple-to-code BDD test suites in JavaScript using the most popular tools in the community

Arrow left icon
Product type Paperback
Published in Feb 2015
Publisher
ISBN-13 9781784392642
Length 392 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Enrique Javier A Rubio Enrique Javier A Rubio
Author Profile Icon Enrique Javier A Rubio
Enrique Javier A Rubio
Arrow right icon
View More author details
Toc

Testing slave resources

Although we have tested the main HAL document for an order, we are still not done. We have discovered that we need to create more HAL resources, order items, and actions. We need to write tests for them too.

The order actions

As we saw earlier, each action has been extracted to a form resource. How do form resources look?

Let's start with the /orders/:orderId/place-order-form resource. We will need a new feature for this, since accessing a form resource is a different operation from accessing the order from the consumer's point of view.

Let's create a test/get_placeOrderForm.js test suite:

'use strict';

var chai = require('chai'),
    expect = chai.expect,
    Q = require('q');

chai.use(require("sinon-chai"));
chai.use(require("chai-as-promised"));

describe('GET /order/:orderId/place-order-form', function () {
  beforeEach(function () {
    this.orderId = "<some order id>";
...
lock icon The rest of the chapter is locked
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Learning Behavior-driven development with Javascript
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime
Modal Close icon
Modal Close icon