X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/299d867b60f431b0dfa50f42630bca91ae53337d..ba4e011fc9132aa17cc6c4e8e74a6310a308291e:/src/store/auth/auth-action.test.ts diff --git a/src/store/auth/auth-action.test.ts b/src/store/auth/auth-action.test.ts index 8a17fe9f42..616f2d2c49 100644 --- a/src/store/auth/auth-action.test.ts +++ b/src/store/auth/auth-action.test.ts @@ -23,6 +23,7 @@ describe('auth-actions', () => { let store: RootStore; let services: ServiceRepository; + const config: any = {}; const actions: ApiActions = { progressFn: (id: string, working: boolean) => { }, errorFn: (id: string, message: string) => { } @@ -32,7 +33,7 @@ describe('auth-actions', () => { beforeEach(() => { axiosMock.reset(); services = createServices(mockConfig({}), actions, axiosInst); - store = configureStore(createBrowserHistory(), services); + store = configureStore(createBrowserHistory(), services, config); localStorage.clear(); importMocks = []; }); @@ -57,6 +58,21 @@ describe('auth-actions', () => { prefs: {} }); + axiosMock + .onGet("https://xc59z.arvadosapi.com/discovery/v1/apis/arvados/v1/rest") + .reply(200, { + baseUrl: "https://xc59z.arvadosapi.com/arvados/v1", + keepWebServiceUrl: "", + keepWebInlineServiceUrl: "", + remoteHosts: {}, + rootUrl: "https://xc59z.arvadosapi.com", + uuidPrefix: "xc59z", + websocketUrl: "", + workbenchUrl: "", + workbench2Url: "", + revision: 12345678 + }); + importMocks.push(ImportMock.mockFunction(servicesModule, 'createServices', services)); // Only test the case when a link account operation is not being cancelled @@ -103,6 +119,12 @@ describe('auth-actions', () => { "rootUrl": "https://zzzzz.arvadosapi.com", "uuidPrefix": "zzzzz", }, + "xc59z": mockConfig({ + apiRevision: 12345678, + baseUrl: "https://xc59z.arvadosapi.com/arvados/v1", + rootUrl: "https://xc59z.arvadosapi.com", + uuidPrefix: "xc59z" + }) }, remoteHosts: { zzzzz: "zzzzz.arvadosapi.com", @@ -120,6 +142,7 @@ describe('auth-actions', () => { "name": "John Doe", "apiRevision": 12345678, "uuid": "zzzzz-tpzed-abcefg", + "userIsActive": true }, { "active": false, "baseUrl": "", @@ -156,22 +179,22 @@ describe('auth-actions', () => { // TODO: Add remaining action tests /* - it('should fire external url to login', () => { - const initialState = undefined; - window.location.assign = jest.fn(); - reducer(initialState, authActions.LOGIN()); - expect(window.location.assign).toBeCalledWith( - `/login?return_to=${window.location.protocol}//${window.location.host}/token` - ); - }); - - it('should fire external url to logout', () => { - const initialState = undefined; - window.location.assign = jest.fn(); - reducer(initialState, authActions.LOGOUT()); - expect(window.location.assign).toBeCalledWith( - `/logout?return_to=${location.protocol}//${location.host}` - ); - }); - */ + it('should fire external url to login', () => { + const initialState = undefined; + window.location.assign = jest.fn(); + reducer(initialState, authActions.LOGIN()); + expect(window.location.assign).toBeCalledWith( + `/login?return_to=${window.location.protocol}//${window.location.host}/token` + ); + }); + + it('should fire external url to logout', () => { + const initialState = undefined; + window.location.assign = jest.fn(); + reducer(initialState, authActions.LOGOUT()); + expect(window.location.assign).toBeCalledWith( + `/logout?return_to=${location.protocol}//${location.host}` + ); + }); + */ });