gitlab-org--gitlab-foss/spec/frontend/ide/services/index_spec.js
Paul Slaughter d4cc92db09
FE remove create branch call in IDE commit
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.
2019-07-18 09:19:18 +02:00

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);
});
});
});