diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue index c54672cd0f89834cb9a595e9333c5a023b31b0d4..a15bf6fadd89bac284020ab433500d682debdda2 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue @@ -556,6 +556,16 @@ export default {
+ { ); }); - it('shows the diverged commits text when the source branch is behind the target', () => { - createComponent({ - mr: { divergedCommitsCount: 9001, userPermissions: { canMerge: false }, canMerge: false }, + describe('shows the diverged commits text when the source branch is behind the target', () => { + it('when the MR can be merged', () => { + createComponent({ + mr: { divergedCommitsCount: 9001 }, + }); + + expect(wrapper.text()).toEqual( + expect.stringContaining('The source branch is 9001 commits behind the target branch'), + ); }); - expect(wrapper.text()).toEqual( - expect.stringContaining('The source branch is 9001 commits behind the target branch'), - ); + it('when the MR cannot be merged', () => { + createComponent({ + mr: { + divergedCommitsCount: 9001, + userPermissions: { canMerge: false }, + canMerge: false, + }, + }); + + expect(wrapper.text()).toEqual( + expect.stringContaining('The source branch is 9001 commits behind the target branch'), + ); + }); }); }); });