"use strict";
//Define the modules required to mocha testing
const assert = require("chai").assert;
const http = require ("http");
const expect = require("chai").expect;
const should = require("should");
const aws = require ("aws-sdk");
const seeder = require("../src/seeder.js");
const dataApp = require("../index.js");

describe("Port function",function(){
  it("Port should return number",function(){
    let myport = dataApp.prototype.port;
    assert(typeof myport, "number");
  });

  it("Port value should be >= 0 and < 65536",function () {
  http.get(dataApp.prototype.port, function (response) {
    assert.equal(response.statusCode, 200);
    });
  });
});

describe("Check the dynamodb function",function(){
  it("Endpoint should listen to the port",function () {
     let server;
     before(function () {
      server = dynamodbOptions.listen(port);
     });
     after(function () {
      assert.ok;
     });
    });

  it("Should be an object",function(){
    let dynamoOptions = dataApp.prototype.dynamodbOptions;
    let raw = new aws.DynamoDB(dynamoOptions);
    raw.should.be.type("object");
  });
  
  it("Should be an object",function(){
    let dynamoOptions =  dataApp.prototype.dynamodbOptions;
    let doc = new aws.DynamoDB(dynamoOptions);
    doc.should.be.type("object");
  });
});

describe ("Start handler function",function(){
  it ("Should not  be null",function(){
    let handler = dataApp.prototype.startHandler;
    assert(handler =! null);
  });
});

describe ("UnmarshalBuffer function",function(){
   it("Should check the json file", () => {
    const invoked = seeder.unmarshalBuffer(JSON);
    const result = JSON.parse.toString();
    assert.isString(result, "Result is an String");
  });
});

describe ("createTable functon",function(){
  it ("Should check as a function",function(){
    const tbl = dataApp.prototype.createTable;
    assert.equal(typeof tbl, "function");
  });
}); 

describe ("Check the Seeder file",function(){
  it("Table name shoud be a string",function(){
    let tblName = seeder.writeSeeds.name;
    expect(tblName).to.be.a("string");
  });
});

describe ("FileExists function", function(){
  it ("File should be an object", function(){
    let fileObj = seeder.fileExists(__filename);
    assert.typeOf(fileObj,"object");  
  });
}); 

@@ -1539,262 +1539,8 @@
 %0D%0A%0D%0A
-describe (%22UnmarshalBuffer function%22,function()%7B%0D%0A   it(%22Should check the json file%22, () =%3E %7B%0D%0A    const invoked = seeder.unmarshalBuffer(JSON);%0D%0A    const result = JSON.parse.toString();%0D%0A    assert.isString(result, %22Result is an String%22);%0D%0A  %7D);%0D%0A%7D);%0D%0A
 %0D%0Ade
@@ -1931,202 +1931,4 @@
 );%0D%0A
-%0D%0Adescribe (%22FileExists function%22, function()%7B%0D%0A  it (%22File should be an object%22, function()%7B%0D%0A    let fileObj = seeder.fileExists(__filename);%0D%0A    assert.typeOf(fileObj,%22object%22);  %0D%0A  %7D);%0D%0A%7D); %0D%0A

Update indexTest.js