Commit f3e4f10d authored by Luke "Jared" Bennett's avatar Luke "Jared" Bennett

Update repo_commit_section to spy service

parent c5b3632f
import Vue from 'vue'; import Vue from 'vue';
import repoCommitSection from '~/repo/components/repo_commit_section.vue'; import repoCommitSection from '~/repo/components/repo_commit_section.vue';
import RepoStore from '~/repo/stores/repo_store'; import RepoStore from '~/repo/stores/repo_store';
import Api from '~/api'; import RepoService from '~/repo/services/repo_service';
describe('RepoCommitSection', () => { fdescribe('RepoCommitSection', () => {
const branch = 'master'; const branch = 'master';
const projectUrl = 'projectUrl'; const projectUrl = 'projectUrl';
const changedFiles = [{ const changedFiles = [{
...@@ -111,7 +111,7 @@ describe('RepoCommitSection', () => { ...@@ -111,7 +111,7 @@ describe('RepoCommitSection', () => {
expect(submitCommit.disabled).toBeFalsy(); expect(submitCommit.disabled).toBeFalsy();
spyOn(vm, 'makeCommit').and.callThrough(); spyOn(vm, 'makeCommit').and.callThrough();
spyOn(Api, 'commitMultiple').and.callFake(() => Promise.resolve()); spyOn(RepoService, 'commitFiles').and.callFake(() => Promise.resolve());
submitCommit.click(); submitCommit.click();
...@@ -119,10 +119,9 @@ describe('RepoCommitSection', () => { ...@@ -119,10 +119,9 @@ describe('RepoCommitSection', () => {
expect(vm.makeCommit).toHaveBeenCalled(); expect(vm.makeCommit).toHaveBeenCalled();
expect(submitCommit.querySelector('.fa-spinner.fa-spin')).toBeTruthy(); expect(submitCommit.querySelector('.fa-spinner.fa-spin')).toBeTruthy();
const args = Api.commitMultiple.calls.allArgs()[0]; const args = RepoService.commitFiles.calls.allArgs()[0];
const { commit_message, actions, branch: payloadBranch } = args[1]; const { commit_message, actions, branch: payloadBranch } = args[0];
expect(args[0]).toBe(projectId);
expect(commit_message).toBe(commitMessage); expect(commit_message).toBe(commitMessage);
expect(actions.length).toEqual(2); expect(actions.length).toEqual(2);
expect(payloadBranch).toEqual(branch); expect(payloadBranch).toEqual(branch);
......
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