1
1
import "jest" ;
2
- import { authenticate as auth } from "../../app/security /authenticate" ;
2
+ import { authenticate as auth } from "../../app/authentication /authenticate" ;
3
3
import axios from "axios" ;
4
4
5
5
var PASSWORD = "password123" ;
6
6
var validJWT ;
7
7
8
- describe ( "authentication" , function ( ) {
9
- beforeAll ( function ( done ) {
8
+ describe ( "authentication" , function ( ) {
9
+ beforeAll ( function ( done ) {
10
10
axios
11
11
. post ( "http://localhost:3000/api/tokens" , {
12
12
user : {
13
13
email : EMAIL ,
14
14
password : PASSWORD
15
15
}
16
16
} )
17
- . then ( function ( resp ) {
17
+ . then ( function ( resp ) {
18
18
console . log ( "=========================" ) ;
19
19
validJWT = resp . data . token . encoded ;
20
20
done ( ) ;
21
21
} )
22
- . catch ( function ( ) {
22
+ . catch ( function ( ) {
23
23
console . log ( "STAND UP AN API SERVER LOCALLY!" ) ;
24
24
} )
25
25
} )
26
26
27
- xit ( "logs in and attaches JSON web token to user" , function ( done ) {
27
+ xit ( "logs in and attaches JSON web token to user" , function ( done ) {
28
28
var finished = false ;
29
29
var client : any = { } ;
30
- var callback = function ( _ , isAuthorized ) {
30
+ var callback = function ( _ , isAuthorized ) {
31
31
expect ( isAuthorized ) . toBeTruthy ( ) ;
32
32
expect ( client . permissions ) . toBeDefined ( ) ;
33
33
expect ( client . permissions . sub ) . toBe ( EMAIL ) ;
@@ -36,10 +36,10 @@ describe("authentication", function() {
36
36
auth ( client , EMAIL , PASSWORD , callback ) ;
37
37
} )
38
38
39
- it ( "logs in with a JWT as a password" , function ( done ) {
39
+ it ( "logs in with a JWT as a password" , function ( done ) {
40
40
var finished = false ;
41
41
var client : any = { } ;
42
- var callback = function ( _ , isAuthorized ) {
42
+ var callback = function ( _ , isAuthorized ) {
43
43
expect ( isAuthorized ) . toBeTruthy ( ) ;
44
44
expect ( client . permissions ) . toBeDefined ( ) ;
45
45
expect ( client . permissions . sub ) . toBe ( '[email protected] ' ) ;
0 commit comments