@@ -50,36 +50,46 @@ describe("generateToken test", function() {
50
50
patreonLicense = extractLicenseKey ( res . data ) ;
51
51
assert . ok ( validatelicenseKeyRegex ( patreonLicense ) ) ;
52
52
done ( ) ;
53
- } ) ;
53
+ } ) . catch ( err => done ( err ) ) ;
54
+ } ) ;
55
+
56
+ it ( "Should create patreon token for invalid patron" , function ( done ) {
57
+ mock . onGet ( / i d e n t i t y / ) . reply ( 200 , patreon . formerIdentityFail ) ;
58
+ if ( ! config ?. patreon ) this . skip ( ) ;
59
+ getGenerateToken ( "patreon" , "patreon_code" , "" ) . then ( res => {
60
+ patreonLicense = extractLicenseKey ( res . data ) ;
61
+ assert . ok ( validatelicenseKeyRegex ( patreonLicense ) ) ;
62
+ done ( ) ;
63
+ } ) . catch ( err => done ( err ) ) ;
54
64
} ) ;
55
65
56
66
it ( "Should be able to create new local token" , function ( done ) {
57
67
createAndSaveToken ( TokenType . local ) . then ( ( licenseKey ) => {
58
68
assert . ok ( validatelicenseKeyRegex ( licenseKey ) ) ;
59
69
localLicense = licenseKey ;
60
70
done ( ) ;
61
- } ) ;
71
+ } ) . catch ( err => done ( err ) ) ;
62
72
} ) ;
63
73
64
74
it ( "Should return 400 if missing code parameter" , function ( done ) {
65
75
getGenerateToken ( "patreon" , null , "" ) . then ( res => {
66
76
assert . strictEqual ( res . status , 400 ) ;
67
77
done ( ) ;
68
- } ) ;
78
+ } ) . catch ( err => done ( err ) ) ;
69
79
} ) ;
70
80
71
81
it ( "Should return 403 if missing adminuserID parameter" , function ( done ) {
72
82
getGenerateToken ( "local" , "fake-code" , null ) . then ( res => {
73
83
assert . strictEqual ( res . status , 403 ) ;
74
84
done ( ) ;
75
- } ) ;
85
+ } ) . catch ( err => done ( err ) ) ;
76
86
} ) ;
77
87
78
88
it ( "Should return 403 for invalid adminuserID parameter" , function ( done ) {
79
89
getGenerateToken ( "local" , "fake-code" , "fakeAdminID" ) . then ( res => {
80
90
assert . strictEqual ( res . status , 403 ) ;
81
91
done ( ) ;
82
- } ) ;
92
+ } ) . catch ( err => done ( err ) ) ;
83
93
} ) ;
84
94
} ) ;
85
95
@@ -96,7 +106,7 @@ describe("verifyToken static tests", function() {
96
106
getVerifyToken ( null ) . then ( res => {
97
107
assert . strictEqual ( res . status , 400 ) ;
98
108
done ( ) ;
99
- } ) ;
109
+ } ) . catch ( err => done ( err ) ) ;
100
110
} ) ;
101
111
} ) ;
102
112
0 commit comments