projects
/
arvados-workbench2.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
refs #14801-api-resonse-is-not-complete
[arvados-workbench2.git]
/
src
/
store
/
auth
/
auth-reducer.test.ts
diff --git
a/src/store/auth/auth-reducer.test.ts
b/src/store/auth/auth-reducer.test.ts
index 0e05263d4301a7b3d94f0408670da9a9cc019fd5..773f9f82dbd737b2e7f0d3fa843b5be4779d6d57 100644
(file)
--- a/
src/store/auth/auth-reducer.test.ts
+++ b/
src/store/auth/auth-reducer.test.ts
@@
-6,14
+6,20
@@
import { authReducer, AuthState } from "./auth-reducer";
import { AuthAction, authActions } from "./auth-action";
import 'jest-localstorage-mock';
import { AuthAction, authActions } from "./auth-action";
import 'jest-localstorage-mock';
-import { createServices } from "../../services/services";
+import { createServices } from "~/services/services";
+import { mockConfig } from '~/common/config';
+import { ApiActions } from "~/services/api/api-actions";
describe('auth-reducer', () => {
let reducer: (state: AuthState | undefined, action: AuthAction) => any;
describe('auth-reducer', () => {
let reducer: (state: AuthState | undefined, action: AuthAction) => any;
+ const actions: ApiActions = {
+ progressFn: (id: string, working: boolean) => {},
+ errorFn: (id: string, message: string) => {}
+ };
beforeAll(() => {
localStorage.clear();
beforeAll(() => {
localStorage.clear();
- reducer = authReducer(createServices(
"/arvados/v1"
));
+ reducer = authReducer(createServices(
mockConfig({}), actions
));
});
it('should correctly initialise state', () => {
});
it('should correctly initialise state', () => {
@@
-23,12
+29,17
@@
describe('auth-reducer', () => {
firstName: "John",
lastName: "Doe",
uuid: "uuid",
firstName: "John",
lastName: "Doe",
uuid: "uuid",
- ownerUuid: "ownerUuid"
+ ownerUuid: "ownerUuid",
+ identityUrl: "identityUrl",
+ prefs: {},
+ isAdmin: false
};
};
- const state = reducer(initialState, authActions.INIT({
user, token: "token"
}));
+ const state = reducer(initialState, authActions.INIT({
user, token: "token"
}));
expect(state).toEqual({
apiToken: "token",
expect(state).toEqual({
apiToken: "token",
- user
+ user,
+ sshKeys: [],
+ sessions: []
});
});
});
});
@@
-38,7
+49,9
@@
describe('auth-reducer', () => {
const state = reducer(initialState, authActions.SAVE_API_TOKEN("token"));
expect(state).toEqual({
apiToken: "token",
const state = reducer(initialState, authActions.SAVE_API_TOKEN("token"));
expect(state).toEqual({
apiToken: "token",
- user: undefined
+ user: undefined,
+ sshKeys: [],
+ sessions: []
});
});
});
});
@@
-50,18
+63,26
@@
describe('auth-reducer', () => {
firstName: "John",
lastName: "Doe",
uuid: "uuid",
firstName: "John",
lastName: "Doe",
uuid: "uuid",
- ownerUuid: "ownerUuid"
+ ownerUuid: "ownerUuid",
+ identityUrl: "identityUrl",
+ prefs: {},
+ isAdmin: false
};
const state = reducer(initialState, authActions.USER_DETAILS_SUCCESS(user));
expect(state).toEqual({
apiToken: undefined,
};
const state = reducer(initialState, authActions.USER_DETAILS_SUCCESS(user));
expect(state).toEqual({
apiToken: undefined,
+ sshKeys: [],
+ sessions: [],
user: {
email: "test@test.com",
firstName: "John",
lastName: "Doe",
uuid: "uuid",
ownerUuid: "ownerUuid",
user: {
email: "test@test.com",
firstName: "John",
lastName: "Doe",
uuid: "uuid",
ownerUuid: "ownerUuid",
+ identityUrl: "identityUrl",
+ prefs: {},
+ isAdmin: false
}
});
});
}
});
});