@@ -11,18 +11,18 @@ if (typeof Promise !== 'undefined') {
11
11
test_salt_returns_promise_on_no_args : function ( assert ) {
12
12
// make sure test passes with non-native implementations such as bluebird
13
13
// http://stackoverflow.com/questions/27746304/how-do-i-tell-if-an-object-is-a-promise
14
- assert . ok ( typeof bcrypt . genSalt ( ) . then === 'function' , "Should return a promise" ) ;
14
+ assert . strictEqual ( typeof bcrypt . genSalt ( ) . then , 'function' , "Should return a promise" ) ;
15
15
assert . done ( ) ;
16
16
} ,
17
17
test_salt_returns_promise_on_null_callback : function ( assert ) {
18
- assert . ok ( typeof bcrypt . genSalt ( 13 , null , null ) . then === 'function' , "Should return a promise" ) ;
18
+ assert . strictEqual ( typeof bcrypt . genSalt ( 13 , null , null ) . then , 'function' , "Should return a promise" ) ;
19
19
assert . done ( ) ;
20
20
} ,
21
21
test_salt_length : function ( assert ) {
22
22
assert . expect ( 2 ) ;
23
23
bcrypt . genSalt ( 10 ) . then ( function ( salt ) {
24
- assert . ok ( typeof salt !== 'undefined' , 'salt must not be undefined ' ) ;
25
- assert . equals ( 29 , salt . length , "Salt isn't the correct length." ) ;
24
+ assert . ok ( salt , 'salt must be defined ' ) ;
25
+ assert . strictEqual ( 29 , salt . length , "Salt isn't the correct length." ) ;
26
26
assert . done ( ) ;
27
27
} ) ;
28
28
} ,
@@ -47,7 +47,7 @@ if (typeof Promise !== 'undefined') {
47
47
} ) ;
48
48
} ,
49
49
test_hash_returns_promise_on_null_callback : function ( assert ) {
50
- assert . ok ( typeof bcrypt . hash ( 'password' , 10 , null ) . then === 'function' , "Should return a promise" ) ;
50
+ assert . strictEqual ( typeof bcrypt . hash ( 'password' , 10 , null ) . then , 'function' , "Should return a promise" ) ;
51
51
assert . done ( ) ;
52
52
} ,
53
53
test_hash : function ( assert ) {
@@ -62,7 +62,7 @@ if (typeof Promise !== 'undefined') {
62
62
test_hash_rounds : function ( assert ) {
63
63
assert . expect ( 1 ) ;
64
64
bcrypt . hash ( 'bacon' , 8 ) . then ( function ( hash ) {
65
- assert . equals ( bcrypt . getRounds ( hash ) , 8 , "Number of rounds should be that specified in the function call." ) ;
65
+ assert . strictEqual ( bcrypt . getRounds ( hash ) , 8 , "Number of rounds should be that specified in the function call." ) ;
66
66
assert . done ( ) ;
67
67
} ) ;
68
68
} ,
@@ -114,7 +114,7 @@ if (typeof Promise !== 'undefined') {
114
114
fail ( assert , "should not resolve" ) ;
115
115
} ) . catch ( function ( err ) {
116
116
assert . notEqual ( err , undefined ) ;
117
- assert . equal ( err . message , "Invalid salt. Salt must be in the form of: $Vers$log2(NumRounds)$saltvalue" ) ;
117
+ assert . strictEqual ( err . message , "Invalid salt. Salt must be in the form of: $Vers$log2(NumRounds)$saltvalue" ) ;
118
118
} )
119
119
] ) . then ( function ( ) {
120
120
assert . done ( ) ;
@@ -124,46 +124,46 @@ if (typeof Promise !== 'undefined') {
124
124
assert . expect ( 2 ) ;
125
125
bcrypt . genSalt ( 10 ) . then ( function ( salt ) {
126
126
var split_salt = salt . split ( '$' ) ;
127
- assert . ok ( split_salt [ 1 ] , '2a' ) ;
128
- assert . ok ( split_salt [ 2 ] , '10' ) ;
127
+ assert . strictEqual ( split_salt [ 1 ] , '2a' ) ;
128
+ assert . strictEqual ( split_salt [ 2 ] , '10' ) ;
129
129
assert . done ( ) ;
130
130
} ) ;
131
131
} ,
132
132
test_verify_salt_min_rounds : function ( assert ) {
133
133
assert . expect ( 2 ) ;
134
134
bcrypt . genSalt ( 1 ) . then ( function ( salt ) {
135
135
var split_salt = salt . split ( '$' ) ;
136
- assert . ok ( split_salt [ 1 ] , '2a' ) ;
137
- assert . ok ( split_salt [ 2 ] , '4 ' ) ;
136
+ assert . strictEqual ( split_salt [ 1 ] , '2a' ) ;
137
+ assert . strictEqual ( split_salt [ 2 ] , '04 ' ) ;
138
138
assert . done ( ) ;
139
139
} ) ;
140
140
} ,
141
141
test_verify_salt_max_rounds : function ( assert ) {
142
142
assert . expect ( 2 ) ;
143
143
bcrypt . genSalt ( 100 ) . then ( function ( salt ) {
144
144
var split_salt = salt . split ( '$' ) ;
145
- assert . ok ( split_salt [ 1 ] , '2a' ) ;
146
- assert . ok ( split_salt [ 2 ] , '31' ) ;
145
+ assert . strictEqual ( split_salt [ 1 ] , '2a' ) ;
146
+ assert . strictEqual ( split_salt [ 2 ] , '31' ) ;
147
147
assert . done ( ) ;
148
148
} ) ;
149
149
} ,
150
150
test_hash_compare_returns_promise_on_null_callback : function ( assert ) {
151
- assert . ok ( typeof bcrypt . compare ( 'password' , 'something' , null ) . then === 'function' , "Should return a promise" ) ;
151
+ assert . strictEqual ( typeof bcrypt . compare ( 'password' , 'something' , null ) . then , 'function' , "Should return a promise" ) ;
152
152
assert . done ( ) ;
153
153
} ,
154
154
test_hash_compare : function ( assert ) {
155
155
assert . expect ( 3 ) ;
156
156
bcrypt . genSalt ( 10 ) . then ( function ( salt ) {
157
- assert . equals ( 29 , salt . length , "Salt isn't the correct length." ) ;
157
+ assert . strictEqual ( 29 , salt . length , "Salt isn't the correct length." ) ;
158
158
return bcrypt . hash ( "test" , salt ) ;
159
159
} ) . then ( function ( hash ) {
160
160
return Promise . all (
161
161
[
162
162
bcrypt . compare ( "test" , hash ) . then ( function ( res ) {
163
- assert . equal ( res , true , "These hashes should be equal." ) ;
163
+ assert . strictEqual ( res , true , "These hashes should be equal." ) ;
164
164
} ) ,
165
165
bcrypt . compare ( "blah" , hash ) . then ( function ( res ) {
166
- assert . equal ( res , false , "These hashes should not be equal." ) ;
166
+ assert . strictEqual ( res , false , "These hashes should not be equal." ) ;
167
167
} )
168
168
] ) . then ( function ( ) {
169
169
assert . done ( ) ;
@@ -174,10 +174,10 @@ if (typeof Promise !== 'undefined') {
174
174
assert . expect ( 2 ) ;
175
175
var hash = bcrypt . hashSync ( "test" , bcrypt . genSaltSync ( 10 ) ) ;
176
176
bcrypt . compare ( "" , hash ) . then ( function ( res ) {
177
- assert . equal ( res , false , "These hashes should be equal." ) ;
177
+ assert . strictEqual ( res , false , "These hashes should not be equal." ) ;
178
178
return bcrypt . compare ( "" , "" ) ;
179
179
} ) . then ( function ( res ) {
180
- assert . equal ( res , false , "These hashes should be equal." ) ;
180
+ assert . strictEqual ( res , false , "These hashes should not be equal." ) ;
181
181
assert . done ( ) ;
182
182
} ) ;
183
183
} ,
@@ -201,7 +201,7 @@ if (typeof Promise !== 'undefined') {
201
201
bcrypt . compare ( ) . then ( function ( ) {
202
202
fail ( assert , 'Should not resolve' ) ;
203
203
} ) . catch ( function ( err ) {
204
- assert . equal ( err . message , 'data and hash arguments required' , 'Promise should be rejected when no parameters are supplied' ) ;
204
+ assert . strictEqual ( err . message , 'data and hash arguments required' , 'Promise should be rejected when no parameters are supplied' ) ;
205
205
} ) . then ( function ( ) {
206
206
assert . done ( ) ;
207
207
} ) ;
@@ -211,7 +211,7 @@ if (typeof Promise !== 'undefined') {
211
211
bcrypt . compare ( 'password' ) . then ( function ( ) {
212
212
fail ( assert , 'Should not resolve' ) ;
213
213
} ) . catch ( function ( err ) {
214
- assert . equal ( err . message , 'data and hash arguments required' , 'Promise should be rejected when no parameters are supplied' ) ;
214
+ assert . strictEqual ( err . message , 'data and hash arguments required' , 'Promise should be rejected when no parameters are supplied' ) ;
215
215
} ) . then ( function ( ) {
216
216
assert . done ( ) ;
217
217
} ) ;
0 commit comments