File tree Expand file tree Collapse file tree 4 files changed +11
-7
lines changed Expand file tree Collapse file tree 4 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ Install dependencies :
12
12
```
13
13
$ npm install
14
14
```
15
- Start up rethinkdb and the server :
15
+ Start up rethinkdb and the server (works with rethinkdb 2.3.4) :
16
16
```
17
17
$ rethinkdb
18
18
$ node server.js
Original file line number Diff line number Diff line change 18
18
],
19
19
"dependencies" : {
20
20
"bcrypt" : " 0.8.7" ,
21
- "body-parser" : " 1.13 .2" ,
21
+ "body-parser" : " 1.15 .2" ,
22
22
"chai" : " 3.5.0" ,
23
- "express" : " 4.13.1 " ,
24
- "jsonwebtoken" : " 5.0.4 " ,
23
+ "express" : " 4.14.0 " ,
24
+ "jsonwebtoken" : " 7.1.3 " ,
25
25
"mocha" : " 2.5.3" ,
26
- "rethinkdb" : " 2.0.2" ,
26
+ "rethinkdb" : " 2.3.2" ,
27
+ "sleep" : " 3.0.1" ,
27
28
"supertest" : " 1.2.0" ,
28
- "thinky" : " 2.0.10 "
29
+ "thinky" : " 2.3.3 "
29
30
}
30
31
}
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ module.exports.issue = function(payload) {
4
4
return jwt . sign (
5
5
payload ,
6
6
process . env . TOKEN_SECRET || 'dontforgettochangethissecretvariable' ,
7
- { expiresInMinutes : 180 }
7
+ { expiresIn : 180 }
8
8
) ;
9
9
} ;
10
10
Original file line number Diff line number Diff line change 1
1
var assert = require ( 'chai' ) . assert ;
2
2
var request = require ( 'supertest' ) ;
3
+ var sleep = require ( 'sleep' ) ;
3
4
4
5
var url = 'http://localhost:8000/api' ;
5
6
@@ -36,6 +37,7 @@ describe('User Tests', function() {
36
37
. post ( '/user' )
37
38
. send ( { 'username' : 'UserName1' , 'password' : 'Password1' } )
38
39
. end ( function ( err , res ) {
40
+ sleep . sleep ( 1 ) ; //needed so JWT's aren't created too quickly with the same usernames
39
41
assert . equal ( res . status , 200 ) ;
40
42
assert . equal ( res . body . user . username , 'UserName1' ) ;
41
43
assert . notEqual ( res . body . user . password , 'Password1' ) ;
@@ -61,6 +63,7 @@ describe('User Tests', function() {
61
63
. post ( '/user' )
62
64
. send ( { 'username' : 'UserName2' , 'password' : 'Password2' } )
63
65
. end ( function ( err , res ) {
66
+ sleep . sleep ( 1 ) ; //needed so JWT's aren't created too quickly with the same usernames
64
67
assert . equal ( res . status , 200 ) ;
65
68
assert . equal ( res . body . user . username , 'UserName2' ) ;
66
69
assert . notEqual ( res . body . user . password , 'Password2' ) ;
You can’t perform that action at this time.
0 commit comments