@@ -3,13 +3,22 @@ import { ClientCredentials } from "simple-oauth2";
33
44import {
55 BackendClient ,
6+ BackendClientOpts ,
67 createBackendClient ,
78 HTTPAuthType ,
89} from "../index" ;
910
11+ const projectId = "proj_abc123" ;
12+ const clientParams : BackendClientOpts = {
13+ credentials : {
14+ clientId : "test-client-id" ,
15+ clientSecret : "test-client-secret" ,
16+ } ,
17+ projectId,
18+ } ;
19+
1020let client : BackendClient ;
1121let customDomainClient : BackendClient ;
12- const projectId = "proj_abc123" ;
1322
1423beforeEach ( ( ) => {
1524 // @ts -ignore
@@ -23,21 +32,10 @@ beforeEach(() => {
2332 } ) ) ;
2433
2534 client = new BackendClient (
26- {
27- credentials : {
28- clientId : "test-client-id" ,
29- clientSecret : "test-client-secret" ,
30- } ,
31- projectId,
32- } ,
35+ clientParams ,
3336 ) ;
34-
3537 customDomainClient = new BackendClient ( {
36- credentials : {
37- clientId : "test-client-id" ,
38- clientSecret : "test-client-secret" ,
39- } ,
40- projectId,
38+ ...clientParams ,
4139 workflowDomain : "example.com" ,
4240 } ) ;
4341} ) ;
@@ -50,15 +48,7 @@ afterEach(() => {
5048describe ( "BackendClient" , ( ) => {
5149 describe ( "createBackendClient" , ( ) => {
5250 it ( "should mock the createBackendClient method and return a BackendClient instance" , ( ) => {
53- const params = {
54- credentials : {
55- clientId : "test-client-id" ,
56- clientSecret : "test" ,
57- } ,
58- projectId,
59- } ;
60-
61- client = createBackendClient ( params ) ;
51+ const client = createBackendClient ( clientParams ) ;
6252 expect ( client ) . toBeInstanceOf ( BackendClient ) ;
6353 } ) ;
6454 } ) ;
0 commit comments