@@ -21,7 +21,7 @@ test('hashUserKey', () => {
2121
2222test ( 'authenticate / success in node (200)' , done => {
2323
24- fetchMock . getOnce ( authUrl + '/v2/auth' , ( url , opts ) => {
24+ fetchMock . getOnce ( authUrl + '/v2/auth?s=1.1 ' , ( url , opts ) => {
2525 // @ts -ignore
2626 expect ( opts . headers [ 'Authorization' ] ) . toBe ( `Bearer ${ authorizationKey } ` ) ; // auth request must contain Authorization header with config authorizationKey
2727 return { status : 200 , body : authDataResponseSample } ;
@@ -40,7 +40,7 @@ test('authenticate / success in browser (200)', done => {
4040
4141 const userKeys = [ 'emi@split.io' , 'maldo@split.io' ] ;
4242
43- fetchMock . getOnce ( authUrl + '/v2/auth?users=emi%40split.io&users=maldo%40split.io' , ( url , opts ) => {
43+ fetchMock . getOnce ( authUrl + '/v2/auth?s=1.1& users=emi%40split.io&users=maldo%40split.io' , ( url , opts ) => {
4444 // @ts -ignore
4545 expect ( opts . headers [ 'Authorization' ] ) . toBe ( `Bearer ${ authorizationKey } ` ) ; // auth request must contain Authorization header with config authorizationKey
4646 return { status : 200 , body : authDataResponseSample } ;
@@ -57,7 +57,7 @@ test('authenticate / success in browser (200)', done => {
5757
5858test ( 'authenticate / bad request in browser due to no user keys (400)' , done => {
5959
60- fetchMock . getOnce ( authUrl + '/v2/auth' , { status : 400 , body : '"no user specified"' } ) ;
60+ fetchMock . getOnce ( authUrl + '/v2/auth?s=1.1 ' , { status : 400 , body : '"no user specified"' } ) ;
6161
6262 authenticate ( [ ] ) . then ( ( ) => {
6363 throw new Error ( 'if bad request, promise is rejected' ) ;
@@ -70,7 +70,7 @@ test('authenticate / bad request in browser due to no user keys (400)', done =>
7070
7171test ( 'authenticate / Invalid credentials (401)' , done => {
7272
73- fetchMock . getOnce ( authUrl + '/v2/auth' , { status : 401 , body : '"Invalid credentials"' } ) ;
73+ fetchMock . getOnce ( authUrl + '/v2/auth?s=1.1 ' , { status : 401 , body : '"Invalid credentials"' } ) ;
7474
7575 authenticate ( [ ] ) . then ( ( ) => {
7676 throw new Error ( 'if invalid credential, promise should be rejected' ) ;
@@ -85,7 +85,7 @@ test('authenticate / HTTP error (other than 401)', done => {
8585
8686 const NOT_OK_STATUS_CODE = 500 ;
8787
88- fetchMock . getOnce ( authUrl + '/v2/auth' , { status : NOT_OK_STATUS_CODE , body : 'some error message' } ) ;
88+ fetchMock . getOnce ( authUrl + '/v2/auth?s=1.1 ' , { status : NOT_OK_STATUS_CODE , body : 'some error message' } ) ;
8989
9090 authenticate ( [ ] ) . then ( ( ) => {
9191 throw new Error ( 'if an HTTP error, promise is rejected' ) ;
@@ -98,7 +98,7 @@ test('authenticate / HTTP error (other than 401)', done => {
9898
9999test ( 'authenticate / Network error (e.g., timeout)' , done => {
100100
101- fetchMock . getOnce ( authUrl + '/v2/auth' , { throws : new TypeError ( 'Network error' ) } ) ;
101+ fetchMock . getOnce ( authUrl + '/v2/auth?s=1.1 ' , { throws : new TypeError ( 'Network error' ) } ) ;
102102
103103 authenticate ( [ ] ) . then ( ( ) => {
104104 throw new Error ( 'if network error, promise is rejected' ) ;
@@ -111,9 +111,9 @@ test('authenticate / Network error (e.g., timeout)', done => {
111111
112112test ( 'authenticate / Error parsing token' , done => {
113113
114- fetchMock . getOnce ( authUrl + '/v2/auth' , { status : 200 , body : { pushEnabled : true , token : jwtSampleInvalid } } ) ;
115- fetchMock . getOnce ( authUrl + '/v2/auth' , { status : 200 , body : { pushEnabled : true , token : jwtSampleNoChannels } } ) ;
116- fetchMock . getOnce ( authUrl + '/v2/auth' , { status : 200 , body : { pushEnabled : true , token : jwtSampleNoIat } } ) ;
114+ fetchMock . getOnce ( authUrl + '/v2/auth?s=1.1 ' , { status : 200 , body : { pushEnabled : true , token : jwtSampleInvalid } } ) ;
115+ fetchMock . getOnce ( authUrl + '/v2/auth?s=1.1 ' , { status : 200 , body : { pushEnabled : true , token : jwtSampleNoChannels } } ) ;
116+ fetchMock . getOnce ( authUrl + '/v2/auth?s=1.1 ' , { status : 200 , body : { pushEnabled : true , token : jwtSampleNoIat } } ) ;
117117
118118 authenticate ( ) . then ( ( ) => {
119119 throw new Error ( 'if invalid token, promise is rejected' ) ;
0 commit comments