Commit ccb31f2f authored by Eric Rosenbaum's avatar Eric Rosenbaum

add unit test for transfer host action

parent dbf9b18d
...@@ -7,7 +7,8 @@ import { ...@@ -7,7 +7,8 @@ import {
removeCurator, removeCurator,
inviteCurator, inviteCurator,
promoteCurator, promoteCurator,
acceptInvitation acceptInvitation,
transferHost
} from '../../../src/views/studio/lib/studio-member-actions'; } from '../../../src/views/studio/lib/studio-member-actions';
import {managers, curators} from '../../../src/views/studio/lib/redux-modules'; import {managers, curators} from '../../../src/views/studio/lib/redux-modules';
import {reducers, initialState} from '../../../src/views/studio/studio-redux'; import {reducers, initialState} from '../../../src/views/studio/studio-redux';
...@@ -399,4 +400,26 @@ describe('acceptInvitation', () => { ...@@ -399,4 +400,26 @@ describe('acceptInvitation', () => {
expect(state.studio.invited).toBe(true); expect(state.studio.invited).toBe(true);
expect(state.studio.curator).toBe(false); expect(state.studio.curator).toBe(false);
}); });
describe('transferHost', () => {
beforeEach(() => {
store = configureStore(reducers, {
...initialState,
studio: {
id: 123123,
managers: 3
}
});
});
test('transfers the host on success', async () => {
api.mockImplementation((opts, callback) => {
callback(null, {}, {statusCode: 200});
});
await store.dispatch(transferHost('password', 'newHostName', 'newHostId'));
const state = store.getState();
expect(api.mock.calls[0][0].uri).toBe('/studios/123123/transfer/newHostName?password=password');
expect(state.studio.owner).toBe('newHostId');
});
});
}); });
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