@@ -85,6 +85,50 @@ describe('getApi:', function() {
8585 done ( ) ;
8686 } ) ;
8787
88+ it ( 'should return an api client with new stackpath baseUrl based on canada' , function ( done ) {
89+ const baseUrl = 'https://api-ca.aglty.io/some-guid-c' ;
90+ const api = agility . getApi ( {
91+ guid : 'some-guid-c' ,
92+ apiKey : 'some-access-token' ,
93+ baseUrl : null
94+ } ) ;
95+ assert . strictEqual ( api . config . baseUrl , baseUrl ) ;
96+ done ( ) ;
97+ } ) ;
98+
99+ it ( 'should return an api client with new stackpath baseUrl based on usa' , function ( done ) {
100+ const baseUrl = 'https://api.aglty.io/some-guid-u' ;
101+ const api = agility . getApi ( {
102+ guid : 'some-guid-u' ,
103+ apiKey : 'some-access-token' ,
104+ baseUrl : null
105+ } ) ;
106+ assert . strictEqual ( api . config . baseUrl , baseUrl ) ;
107+ done ( ) ;
108+ } ) ;
109+
110+ it ( 'should return an api client with new stackpath baseUrl based on dev' , function ( done ) {
111+ const baseUrl = 'https://api-dev.aglty.io/some-guid-d' ;
112+ const api = agility . getApi ( {
113+ guid : 'some-guid-d' ,
114+ apiKey : 'some-access-token' ,
115+ baseUrl : null
116+ } ) ;
117+ assert . strictEqual ( api . config . baseUrl , baseUrl ) ;
118+ done ( ) ;
119+ } ) ;
120+
121+ it ( 'should return an api client with legacy stackpath baseUrl' , function ( done ) {
122+ const baseUrl = 'https://some-guid-api.agilitycms.cloud' ;
123+ const api = agility . getApi ( {
124+ guid : 'some-guid' ,
125+ apiKey : 'some-access-token' ,
126+ baseUrl : null
127+ } ) ;
128+ assert . strictEqual ( api . config . baseUrl , baseUrl ) ;
129+ done ( ) ;
130+ } ) ;
131+
88132 // TESTING EXCEPTIONS ----------------------------------------------------
89133
90134 it ( 'should throw an error if guid is not passed-in' , function ( done ) {
0 commit comments