@@ -32,17 +32,14 @@ Given("there is a 3rd party application running, e.g. 'Democracy'", function ()
32
32
// Just documentation
33
33
} ) ;
34
34
35
- Given ( 'there is an organization in Human Connection with these credentials:' , function ( dataTable , callback ) {
35
+ Given ( 'there is an organization in Human Connection with these credentials:' , function ( dataTable ) {
36
36
const User = mongoose . model ( 'users' ) ;
37
37
params = dataTable . hashes ( ) [ 0 ] ;
38
- encrypt ( params . password ) . then ( ( hashedPassword ) => {
38
+ return encrypt ( params . password ) . then ( ( hashedPassword ) => {
39
39
currentUserPassword = params . password ; // remember plain text password
40
40
params . password = hashedPassword ; // hashed password goes into db
41
41
currentUser = new User ( params ) ;
42
- currentUser . save ( function ( err , user ) {
43
- if ( err ) callback ( err ) ;
44
- callback ( ) ;
45
- } ) ;
42
+ return currentUser . save ( ) ;
46
43
} ) ;
47
44
} ) ;
48
45
@@ -52,13 +49,10 @@ Given('I am authenticated', function () {
52
49
} ) ;
53
50
} ) ;
54
51
55
- Given ( 'my user account is verified' , function ( callback ) {
52
+ Given ( 'my user account is verified' , function ( ) {
56
53
// Write code here that turns the phrase above into concrete actions
57
54
currentUser . isVerified = true ;
58
- currentUser . save ( function ( err , user ) {
59
- if ( err ) throw ( err ) ;
60
- callback ( ) ;
61
- } ) ;
55
+ return currentUser . save ( ) ;
62
56
} ) ;
63
57
64
58
When ( 'I send a POST request to {string} with:' , function ( route , body , callback ) {
0 commit comments