d4cc92db09
Previously `start_sha` was intercepted on the frontend to create the correct branch in a separate API call. Now that the commits API supports the `start_sha` parameter directly this workaround is not needed anymore.
31 lines
715 B
JavaScript
31 lines
715 B
JavaScript
import services from '~/ide/services';
|
|
import Api from '~/api';
|
|
|
|
jest.mock('~/api');
|
|
|
|
const TEST_PROJECT_ID = 'alice/wonderland';
|
|
const TEST_BRANCH = 'master-patch-123';
|
|
const TEST_COMMIT_SHA = '123456789';
|
|
|
|
describe('IDE services', () => {
|
|
describe('commit', () => {
|
|
let payload;
|
|
|
|
beforeEach(() => {
|
|
payload = {
|
|
branch: TEST_BRANCH,
|
|
commit_message: 'Hello world',
|
|
actions: [],
|
|
start_sha: TEST_COMMIT_SHA,
|
|
};
|
|
|
|
Api.commitMultiple.mockReturnValue(Promise.resolve());
|
|
});
|
|
|
|
it('should commit', () => {
|
|
services.commit(TEST_PROJECT_ID, payload);
|
|
|
|
expect(Api.commitMultiple).toHaveBeenCalledWith(TEST_PROJECT_ID, payload);
|
|
});
|
|
});
|
|
});
|