UNPKG

697 BJavaScriptView Raw
1"use strict";
2
3var CannedResponses = require("../lib/canned_responses"),
4 expect = require("chai").expect;
5
6describe("CRUD", function() {
7
8 var crud;
9
10 beforeEach(function() {
11 crud = new CannedResponses(__dirname + "/fixtures/crud.js");
12 });
13
14 it("should read in a config file", function() {
15 expect(crud.collection.length).to.equal(4);
16 });
17
18 it("should allow creation", function() {
19 crud.add("GET", "/stuff", {
20 id : 10
21 });
22
23 expect(crud.collection.length).to.equal(5);
24 });
25
26 it("should allow deletions", function() {
27 crud.remove("GET", "/people");
28 crud.remove("POST", "/people");
29
30 expect(crud.collection.length).to.equal(2);
31 });
32
33});
34
35