var http           = require('http');
var bl             = require('bl');
var restify        = require('restify');

const iotcoap         = require('../../index');
iotcoap.rest.run();

describe('rest function test', function () {
    before(function() {

    });

    it('should return 200 when start rest server', function (done) {
        http.get('http://localhost:8848/', function (res) {
            assert(200, res.statusCode);
            done();
        });
    });

    it('should return sensors 20 when post data & id = 10', function (done) {
        var post_data = JSON.stringify({
            id: 10,
            value: 'is id 1',
            sensors1: 19,
            sensors2: 20
        });

        var post_options = {
            host: 'localhost',
            port: '8848',
            path: '',
            method: 'PUT',
            headers: {
                'Content-Type': 'application/json'
            }
        };

        var post_req = http.request(post_options, function(res) {
            res.setEncoding('utf8');
            res.on('data', function (chunk) {
            });
        });

        post_req.write(post_data);
        post_req.end();

        http.get('http://localhost:8848/id/10', function (res) {
            res.pipe(bl(function(err, data) {
                var json = JSON.parse(data)[0];
                if(json.sensors2 === 20){
                    done();
                }
            }));
        });
    });
});
//
//var client = restify.createJsonClient({
//    url: 'http://127.0.0.1:8848/',
//    version: '*'
//});
//
//describe('User Login Test', function() {
//    it('should return login success', function () {
//        client.post();
//    });
//});
@@ -107,16 +107,60 @@
 stify');
+%0Avar _              = require('underscore');
 %0A%0Aconst 
@@ -1506,21 +1506,17 @@
 %7D);%0A%7D);%0A
-//%0A//
+%0A
 var clie
@@ -1547,18 +1547,16 @@
 lient(%7B%0A
-//
     url:
@@ -1568,17 +1568,17 @@
 p://
-127.0.0.1
+localhost
 :884
@@ -1582,18 +1582,16 @@
 8848/',%0A
-//
     vers
@@ -1603,19 +1603,13 @@
 '*'%0A
-//
 %7D);%0A
-//%0A//
+%0A
 desc
@@ -1618,23 +1618,19 @@
 be('
-User Login Test
+Delete Data
 ', f
@@ -1637,26 +1637,24 @@
 unction() %7B%0A
-//
     it('shou
@@ -1667,73 +1667,273 @@
 urn 
-login success', function () %7B%0A//        client.post();%0A//
+empty after delete data', function (done) %7B%0A        client.del('/id/10', function (err, req, res) %7B%7D);%0A        client.get('/id/10', function (err, req, res)%7B%0A            if(_.isEmpty(JSON.parse(res.body)))%7B%0A                done();%0A            %7D%0A        %7D);%0A
     %7D);%0A
 //%7D)
@@ -1928,13 +1928,11 @@
     %7D);%0A
-//
 %7D);

Add the test for delete data on http delete