"use strict";

var request = require("supertest");

var app = require("../js/server/app.js");

describe("App backend server", function () {
    it("should serve the index page", function (done) {
        request(app)
            .get("/index.html")
            .expect(200, done);
    });
});

@@ -43,16 +43,103 @@
 rtest%22);
+%0Avar mongodb = require(%22mongodb%22);%0A%0Avar mongoUrl = %22mongodb://mongodb:27017/myproject%22;
 %0A%0Avar ap
@@ -368,13 +368,1607 @@
 %0A    %7D);
+%0A%0A    describe(%22List%22, function () %7B%0A        describe(%22Saving%22, function () %7B%0A            var data = %7B%0A                _id: %22my-test-id%22,%0A                tasks: %5B%0A                    %7B%0A                        title: %22One%22,%0A                        done: false%0A                    %7D,%0A                    %7B%0A                        title: %22two%22,%0A                        done: true%0A                    %7D%0A                %5D%0A            %7D;%0A%0A            beforeEach(function () %7B%0A                mongodb.MongoClient.connect(mongoUrl, function (err, db) %7B%0A                    var collection = db.collection(%22documents%22);%0A%0A                    collection.drop();%0A%0A                    db.close();%0A                %7D);%0A            %7D);%0A%0A            it(%22should accept the request%22, function (done) %7B%0A                request(app)%0A                    .put(%22/list/my-test-id%22)%0A                    .set(%22Accept%22, %22application/json%22)%0A                    .send(data)%0A                    .expect(200, done);%0A            %7D);%0A%0A            it(%22should save and reload the data%22, function (done) %7B%0A                request(app)%0A                    .put(%22/list/my-test-id%22)%0A                    .set(%22Accept%22, %22application/json%22)%0A                    .send(data)%0A                    .end(function (err, res) %7B%0A                        request(app)%0A                            .get(%22/list/my-test-id%22)%0A                            .set(%22Accept%22, %22application/json%22)%0A                            .expect(JSON.stringify(data))%0A                            .expect(200, done);%0A                    %7D);%0A            %7D);%0A        %7D);%0A    %7D);
 %0A%7D);%0A

Test for simple save/reload of a List