Commit c9a34e59 authored by Lyza Danger Gardner's avatar Lyza Danger Gardner Committed by Lyza Gardner

Refactor AuthService

Refactor AuthService to be a more conventional class with instance
methods and fields as per other services.

Make a small change to the API service to ensure that `getAccessToken`
is correctly invoked on an auth service instance.
parent e0c331e4
......@@ -217,7 +217,7 @@ export class APIService {
/** @param {string} route */
const apiCall = route =>
createAPICall(links, route, {
getAccessToken: auth.getAccessToken,
getAccessToken: () => auth.getAccessToken(),
getClientId,
onRequestStarted: store.apiRequestStarted,
onRequestFinished: store.apiRequestFinished,
......
This diff is collapsed.
......@@ -137,7 +137,7 @@ describe('AuthService', () => {
context('when the access token request fails', () => {
const expectedErr = new Error('Grant token exchange failed');
beforeEach('make access token requests fail', () => {
fakeClient.exchangeGrantToken.returns(Promise.reject(expectedErr));
fakeClient.exchangeGrantToken.rejects(expectedErr);
});
function assertThatAccessTokenPromiseWasRejectedAnd(func) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment