2019-07-31 22:56:46 +05:30
|
|
|
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-10-12 21:52:04 +05:30
|
|
|
start_sha: TEST_COMMIT_SHA,
|
2019-07-31 22:56:46 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
Api.commitMultiple.mockReturnValue(Promise.resolve());
|
|
|
|
});
|
|
|
|
|
2019-10-12 21:52:04 +05:30
|
|
|
it('should commit', () => {
|
|
|
|
services.commit(TEST_PROJECT_ID, payload);
|
2019-07-31 22:56:46 +05:30
|
|
|
|
2019-10-12 21:52:04 +05:30
|
|
|
expect(Api.commitMultiple).toHaveBeenCalledWith(TEST_PROJECT_ID, payload);
|
2019-07-31 22:56:46 +05:30
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|