2019-06-17 13:53:58 -04:00
|
|
|
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: [],
|
2019-06-26 10:07:56 -04:00
|
|
|
start_sha: TEST_COMMIT_SHA,
|
2019-06-17 13:53:58 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
Api.commitMultiple.mockReturnValue(Promise.resolve());
|
|
|
|
});
|
|
|
|
|
2019-06-26 10:07:56 -04:00
|
|
|
it('should commit', () => {
|
|
|
|
services.commit(TEST_PROJECT_ID, payload);
|
2019-06-17 13:53:58 -04:00
|
|
|
|
2019-06-26 10:07:56 -04:00
|
|
|
expect(Api.commitMultiple).toHaveBeenCalledWith(TEST_PROJECT_ID, payload);
|
2019-06-17 13:53:58 -04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|