@@ -6,16 +6,19 @@ const expect = require("chai").expect;
6
6
const should = require ( "should" ) ;
7
7
const aws = require ( "aws-sdk" ) ;
8
8
const seeder = require ( "../src/seeder.js" ) ;
9
- const dataApp = require ( "../index.js" ) ;
9
+ const Plugin = require ( "../index.js" ) ;
10
+
11
+ const serverlessMock = require ( "./serverlessMock" ) ;
10
12
11
13
describe ( "Port function" , function ( ) {
12
14
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" ) ;
15
17
} ) ;
16
18
17
19
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 ) {
19
22
assert . equal ( response . statusCode , 200 ) ;
20
23
done ( ) ;
21
24
} ) ;
@@ -34,29 +37,29 @@ describe("Check the dynamodb function",function(){
34
37
} ) ;
35
38
36
39
it ( "Should be an object" , function ( ) {
37
- let dynamoOptions = dataApp . prototype . dynamodbOptions ;
40
+ let dynamoOptions = Plugin . prototype . dynamodbOptions ;
38
41
let raw = new aws . DynamoDB ( dynamoOptions ) ;
39
42
raw . should . be . type ( "object" ) ;
40
43
} ) ;
41
44
42
45
it ( "Should be an object" , function ( ) {
43
- let dynamoOptions = dataApp . prototype . dynamodbOptions ;
46
+ let dynamoOptions = Plugin . prototype . dynamodbOptions ;
44
47
let doc = new aws . DynamoDB ( dynamoOptions ) ;
45
48
doc . should . be . type ( "object" ) ;
46
49
} ) ;
47
50
} ) ;
48
51
49
52
describe ( "Start handler function" , function ( ) {
50
53
it ( "Should not be null" , function ( ) {
51
- let handler = dataApp . prototype . startHandler ;
54
+ let handler = Plugin . prototype . startHandler ;
52
55
assert ( handler = ! null ) ;
53
56
} ) ;
54
57
} ) ;
55
58
56
59
57
60
describe ( "createTable functon" , function ( ) {
58
61
it ( "Should check as a function" , function ( ) {
59
- const tbl = dataApp . prototype . createTable ;
62
+ const tbl = Plugin . prototype . createTable ;
60
63
assert . equal ( typeof tbl , "function" ) ;
61
64
} ) ;
62
65
} ) ;
0 commit comments