@@ -6,16 +6,19 @@ const expect = require("chai").expect;
66const should = require ( "should" ) ;
77const aws = require ( "aws-sdk" ) ;
88const seeder = require ( "../src/seeder.js" ) ;
9- const dataApp = require ( "../index.js" ) ;
9+ const Plugin = require ( "../index.js" ) ;
10+
11+ const serverlessMock = require ( "./serverlessMock" ) ;
1012
1113describe ( "Port function" , function ( ) {
1214 it ( "Port should return number" , function ( ) {
13- let myport = dataApp . prototype . port ;
14- assert ( typeof myport , "number" ) ;
15+ let service = new Plugin ( serverlessMock , { } ) ;
16+ assert ( typeof service . port , "number" ) ;
1517 } ) ;
1618
1719 it ( "Port value should be >= 0 and < 65536" , function ( done ) {
18- http . get ( `http://localhost:${ dataApp . prototype . port } /shell/` , function ( response ) {
20+ let service = new Plugin ( serverlessMock , { } ) ;
21+ http . get ( `http://localhost:${ service . port } /shell/` , function ( response ) {
1922 assert . equal ( response . statusCode , 200 ) ;
2023 done ( ) ;
2124 } ) ;
@@ -34,29 +37,29 @@ describe("Check the dynamodb function",function(){
3437 } ) ;
3538
3639 it ( "Should be an object" , function ( ) {
37- let dynamoOptions = dataApp . prototype . dynamodbOptions ;
40+ let dynamoOptions = Plugin . prototype . dynamodbOptions ;
3841 let raw = new aws . DynamoDB ( dynamoOptions ) ;
3942 raw . should . be . type ( "object" ) ;
4043 } ) ;
4144
4245 it ( "Should be an object" , function ( ) {
43- let dynamoOptions = dataApp . prototype . dynamodbOptions ;
46+ let dynamoOptions = Plugin . prototype . dynamodbOptions ;
4447 let doc = new aws . DynamoDB ( dynamoOptions ) ;
4548 doc . should . be . type ( "object" ) ;
4649 } ) ;
4750} ) ;
4851
4952describe ( "Start handler function" , function ( ) {
5053 it ( "Should not be null" , function ( ) {
51- let handler = dataApp . prototype . startHandler ;
54+ let handler = Plugin . prototype . startHandler ;
5255 assert ( handler = ! null ) ;
5356 } ) ;
5457} ) ;
5558
5659
5760describe ( "createTable functon" , function ( ) {
5861 it ( "Should check as a function" , function ( ) {
59- const tbl = dataApp . prototype . createTable ;
62+ const tbl = Plugin . prototype . createTable ;
6063 assert . equal ( typeof tbl , "function" ) ;
6164 } ) ;
6265} ) ;
0 commit comments