Skip to content
代码片段 群组 项目
提交 3fef3cb2 编辑于 作者: Olena Horal-Koretska's avatar Olena Horal-Koretska
浏览文件

Merge branch '391039-vue3-migration-compare_versions_spec' into 'master'

No related branches found
No related tags found
无相关合并请求
......@@ -21,6 +21,7 @@ beforeEach(() => {
describe('CompareVersions', () => {
let wrapper;
let store;
let dispatchMock;
const targetBranchName = 'tmp-wine-dev';
const { commit } = getDiffWithCommit;
......@@ -29,6 +30,8 @@ describe('CompareVersions', () => {
store.state.diffs.commit = { ...store.state.diffs.commit, ...commitArgs };
}
dispatchMock = jest.spyOn(store, 'dispatch');
wrapper = mount(CompareVersionsComponent, {
store,
propsData: {
......@@ -146,7 +149,7 @@ describe('CompareVersions', () => {
it('renders short commit ID', () => {
expect(wrapper.text()).toContain('Viewing commit');
expect(wrapper.text()).toContain(wrapper.vm.commit.short_id);
expect(wrapper.text()).toContain(commit.short_id);
});
});
......@@ -204,10 +207,6 @@ describe('CompareVersions', () => {
setWindowLocation(`?commit_id=${mrCommit.id}`);
});
beforeEach(() => {
jest.spyOn(wrapper.vm, 'moveToNeighboringCommit').mockImplementation(() => {});
});
it('uses the correct href', () => {
const link = getPrevCommitNavElement();
......@@ -219,7 +218,7 @@ describe('CompareVersions', () => {
link.trigger('click');
await nextTick();
expect(wrapper.vm.moveToNeighboringCommit).toHaveBeenCalledWith({
expect(dispatchMock).toHaveBeenCalledWith('diffs/moveToNeighboringCommit', {
direction: 'previous',
});
});
......@@ -238,10 +237,6 @@ describe('CompareVersions', () => {
setWindowLocation(`?commit_id=${mrCommit.id}`);
});
beforeEach(() => {
jest.spyOn(wrapper.vm, 'moveToNeighboringCommit').mockImplementation(() => {});
});
it('uses the correct href', () => {
const link = getNextCommitNavElement();
......@@ -253,7 +248,9 @@ describe('CompareVersions', () => {
link.trigger('click');
await nextTick();
expect(wrapper.vm.moveToNeighboringCommit).toHaveBeenCalledWith({ direction: 'next' });
expect(dispatchMock).toHaveBeenCalledWith('diffs/moveToNeighboringCommit', {
direction: 'next',
});
});
it('renders a disabled button when there is no next commit', () => {
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册