@@ -5,6 +5,7 @@ import * as tokenUtils from "../../src/utils/tokenUtils";
5
5
import MockAdapter from "axios-mock-adapter" ;
6
6
import { validatelicenseKeyRegex } from "../../src/routes/verifyToken" ;
7
7
let mock : MockAdapter ;
8
+ import * as patreon from "../mocks/patreonMock" ;
8
9
9
10
const validateToken = validatelicenseKeyRegex ;
10
11
const fakePatreonIdentity = {
@@ -26,12 +27,8 @@ const fakePatreonIdentity = {
26
27
describe ( "tokenUtils test" , function ( ) {
27
28
before ( function ( ) {
28
29
mock = new MockAdapter ( axios , { onNoMatch : "throwException" } ) ;
29
- mock . onPost ( "https://www.patreon.com/api/oauth2/token" ) . reply ( 200 , {
30
- access_token : "test_access_token" ,
31
- refresh_token : "test_refresh_token" ,
32
- expires_in : 3600 ,
33
- } ) ;
34
- mock . onGet ( / i d e n t i t y / ) . reply ( 200 , fakePatreonIdentity ) ;
30
+ mock . onPost ( "https://www.patreon.com/api/oauth2/token" ) . reply ( 200 , patreon . fakeOauth ) ;
31
+ mock . onGet ( / i d e n t i t y / ) . reply ( 200 , patreon . fakeIdentity ) ;
35
32
} ) ;
36
33
37
34
it ( "Should be able to create patreon token" , function ( done ) {
@@ -50,7 +47,7 @@ describe("tokenUtils test", function() {
50
47
it ( "Should be able to get patreon identity" , function ( done ) {
51
48
if ( ! config ?. patreon ) this . skip ( ) ;
52
49
tokenUtils . getPatreonIdentity ( "fake_access_token" ) . then ( ( result ) => {
53
- assert . deepEqual ( result , fakePatreonIdentity ) ;
50
+ assert . deepEqual ( result , patreon . fakeIdentity ) ;
54
51
done ( ) ;
55
52
} ) ;
56
53
} ) ;
0 commit comments