diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-22 00:08:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-22 00:08:54 +0300 |
commit | 36e363d33d5f75aeb75c552d4b325ed8c2d6105f (patch) | |
tree | 1ca97e2e47c613eed6b6cd4682c36c92067cab46 /spec | |
parent | d91f5211693e913da5df110b8de841fad87e3653 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/merge_request/user_sees_versions_spec.rb | 26 | ||||
-rw-r--r-- | spec/frontend/boards/boards_store_spec.js | 26 | ||||
-rw-r--r-- | spec/frontend/diffs/components/compare_versions_spec.js | 3 | ||||
-rw-r--r-- | spec/frontend/diffs/components/diff_stats_spec.js | 18 | ||||
-rw-r--r-- | spec/frontend/vue_shared/components/changed_file_icon_spec.js | 6 | ||||
-rw-r--r-- | spec/javascripts/ide/components/repo_tab_spec.js | 4 | ||||
-rw-r--r-- | spec/lib/rspec_flaky/report_spec.rb | 8 |
7 files changed, 64 insertions, 27 deletions
diff --git a/spec/features/merge_request/user_sees_versions_spec.rb b/spec/features/merge_request/user_sees_versions_spec.rb index cd62bab412a..cab86f3fd94 100644 --- a/spec/features/merge_request/user_sees_versions_spec.rb +++ b/spec/features/merge_request/user_sees_versions_spec.rb @@ -50,7 +50,7 @@ describe 'Merge request > User sees versions', :js do expect(page).to have_content 'latest version' end - expect(page).to have_content '8 files' + expect(page).to have_content '8 Files' end it_behaves_like 'allows commenting', @@ -84,7 +84,7 @@ describe 'Merge request > User sees versions', :js do end it 'shows comments that were last relevant at that version' do - expect(page).to have_content '5 files' + expect(page).to have_content '5 Files' position = Gitlab::Diff::Position.new( old_path: ".gitmodules", @@ -128,10 +128,12 @@ describe 'Merge request > User sees versions', :js do diff_id: merge_request_diff3.id, start_sha: '6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9' ) - expect(page).to have_content '4 files' + expect(page).to have_content '4 Files' - additions_content = page.find('.diff-stats.is-compare-versions-header .diff-stats-group .js-file-addition-line').text - deletions_content = page.find('.diff-stats.is-compare-versions-header .diff-stats-group .js-file-deletion-line').text + additions_content = page.find('.diff-stats.is-compare-versions-header .diff-stats-group svg.ic-file-addition') + .ancestor('.diff-stats-group').text + deletions_content = page.find('.diff-stats.is-compare-versions-header .diff-stats-group svg.ic-file-deletion') + .ancestor('.diff-stats-group').text expect(additions_content).to eq '15' expect(deletions_content).to eq '6' @@ -154,10 +156,12 @@ describe 'Merge request > User sees versions', :js do end it 'show diff between new and old version' do - additions_content = page.find('.diff-stats.is-compare-versions-header .diff-stats-group .js-file-addition-line').text - deletions_content = page.find('.diff-stats.is-compare-versions-header .diff-stats-group .js-file-deletion-line').text + additions_content = page.find('.diff-stats.is-compare-versions-header .diff-stats-group svg.ic-file-addition') + .ancestor('.diff-stats-group').text + deletions_content = page.find('.diff-stats.is-compare-versions-header .diff-stats-group svg.ic-file-deletion') + .ancestor('.diff-stats-group').text - expect(page).to have_content '4 files' + expect(page).to have_content '4 Files' expect(additions_content).to eq '15' expect(deletions_content).to eq '6' end @@ -167,7 +171,7 @@ describe 'Merge request > User sees versions', :js do page.within '.mr-version-dropdown' do expect(page).to have_content 'latest version' end - expect(page).to have_content '8 files' + expect(page).to have_content '8 Files' end it_behaves_like 'allows commenting', @@ -193,7 +197,7 @@ describe 'Merge request > User sees versions', :js do find('.btn-default').click click_link 'version 1' end - expect(page).to have_content '0 files' + expect(page).to have_content '0 Files' end end @@ -219,7 +223,7 @@ describe 'Merge request > User sees versions', :js do expect(page).to have_content 'version 1' end - expect(page).to have_content '0 files' + expect(page).to have_content '0 Files' end end diff --git a/spec/frontend/boards/boards_store_spec.js b/spec/frontend/boards/boards_store_spec.js index bf3d81d3117..2dc9039bc9d 100644 --- a/spec/frontend/boards/boards_store_spec.js +++ b/spec/frontend/boards/boards_store_spec.js @@ -6,7 +6,7 @@ import eventHub from '~/boards/eventhub'; import { listObj, listObjDuplicate } from './mock_data'; import ListIssue from '~/boards/models/issue'; -import '~/boards/models/list'; +import List from '~/boards/models/list'; jest.mock('js-cookie'); @@ -190,6 +190,30 @@ describe('boardsStore', () => { }); }); + describe('saveList', () => { + let list; + + beforeEach(() => { + list = new List(listObj); + setupDefaultResponses(); + }); + + it('makes a request to save a list', () => { + const expectedResponse = expect.objectContaining({ issues: [createTestIssue()] }); + const expectedListValue = { + id: listObj.id, + position: listObj.position, + type: listObj.list_type, + label: listObj.label, + }; + expect(list.id).toBe(listObj.id); + expect(list.position).toBe(listObj.position); + expect(list).toMatchObject(expectedListValue); + + return expect(boardsStore.saveList(list)).resolves.toEqual(expectedResponse); + }); + }); + describe('getIssuesForList', () => { const id = 'TOO-MUCH'; const url = `${endpoints.listsEndpoint}/${id}/issues?id=${id}`; diff --git a/spec/frontend/diffs/components/compare_versions_spec.js b/spec/frontend/diffs/components/compare_versions_spec.js index ff92a12eaf6..5f919408459 100644 --- a/spec/frontend/diffs/components/compare_versions_spec.js +++ b/spec/frontend/diffs/components/compare_versions_spec.js @@ -49,7 +49,8 @@ describe('CompareVersions', () => { expect(treeListBtn.exists()).toBe(true); expect(treeListBtn.attributes('title')).toBe('Hide file browser'); - expect(treeListBtn.find(Icon).props('name')).toBe('file-tree'); + expect(treeListBtn.findAll(Icon).length).not.toBe(0); + expect(treeListBtn.find(Icon).props('name')).toBe('collapse-left'); }); it('should render comparison dropdowns with correct values', () => { diff --git a/spec/frontend/diffs/components/diff_stats_spec.js b/spec/frontend/diffs/components/diff_stats_spec.js index aa5c7f6278a..4482abf18c1 100644 --- a/spec/frontend/diffs/components/diff_stats_spec.js +++ b/spec/frontend/diffs/components/diff_stats_spec.js @@ -1,4 +1,5 @@ import { shallowMount } from '@vue/test-utils'; +import Icon from '~/vue_shared/components/icon.vue'; import DiffStats from '~/diffs/components/diff_stats.vue'; describe('diff_stats', () => { @@ -23,11 +24,18 @@ describe('diff_stats', () => { }, }); - const findFileLine = name => wrapper.find(name); - const additions = findFileLine('.js-file-addition-line'); - const deletions = findFileLine('.js-file-deletion-line'); + const findIcon = name => + wrapper + .findAll(Icon) + .filter(c => c.attributes('name') === name) + .at(0).element.parentNode; - expect(additions.text()).toBe('100'); - expect(deletions.text()).toBe('200'); + const additions = findIcon('file-addition'); + const deletions = findIcon('file-deletion'); + const filesChanged = findIcon('doc-code'); + + expect(additions.textContent).toContain('100'); + expect(deletions.textContent).toContain('200'); + expect(filesChanged.textContent).toContain('300'); }); }); diff --git a/spec/frontend/vue_shared/components/changed_file_icon_spec.js b/spec/frontend/vue_shared/components/changed_file_icon_spec.js index 02c4dabeffc..5d2aec6734f 100644 --- a/spec/frontend/vue_shared/components/changed_file_icon_spec.js +++ b/spec/frontend/vue_shared/components/changed_file_icon_spec.js @@ -56,10 +56,10 @@ describe('Changed file icon', () => { describe.each` file | iconName | tooltipText | desc - ${changedFile()} | ${'file-modified-solid'} | ${'Unstaged modification'} | ${'with file changed'} + ${changedFile()} | ${'file-modified'} | ${'Unstaged modification'} | ${'with file changed'} ${stagedFile()} | ${'file-modified-solid'} | ${'Staged modification'} | ${'with file staged'} - ${changedAndStagedFile()} | ${'file-modified-solid'} | ${'Unstaged and staged modification'} | ${'with file changed and staged'} - ${newFile()} | ${'file-addition-solid'} | ${'Unstaged addition'} | ${'with file new'} + ${changedAndStagedFile()} | ${'file-modified'} | ${'Unstaged and staged modification'} | ${'with file changed and staged'} + ${newFile()} | ${'file-addition'} | ${'Unstaged addition'} | ${'with file new'} `('$desc', ({ file, iconName, tooltipText }) => { beforeEach(() => { factory({ file }); diff --git a/spec/javascripts/ide/components/repo_tab_spec.js b/spec/javascripts/ide/components/repo_tab_spec.js index 7466ed5468b..3b52f279bf2 100644 --- a/spec/javascripts/ide/components/repo_tab_spec.js +++ b/spec/javascripts/ide/components/repo_tab_spec.js @@ -93,13 +93,13 @@ describe('RepoTab', () => { Vue.nextTick() .then(() => { - expect(vm.$el.querySelector('.file-modified-solid')).toBeNull(); + expect(vm.$el.querySelector('.file-modified')).toBeNull(); vm.$el.dispatchEvent(new Event('mouseout')); }) .then(Vue.nextTick) .then(() => { - expect(vm.$el.querySelector('.file-modified-solid')).not.toBeNull(); + expect(vm.$el.querySelector('.file-modified')).not.toBeNull(); done(); }) diff --git a/spec/lib/rspec_flaky/report_spec.rb b/spec/lib/rspec_flaky/report_spec.rb index 6a98a7a4e6b..1f0eff83db0 100644 --- a/spec/lib/rspec_flaky/report_spec.rb +++ b/spec/lib/rspec_flaky/report_spec.rb @@ -3,11 +3,11 @@ require 'spec_helper' describe RspecFlaky::Report, :aggregate_failures do - let(:a_hundred_days) { 3600 * 24 * 100 } + let(:thirty_one_days) { 3600 * 24 * 31 } let(:collection_hash) do { a: { example_id: 'spec/foo/bar_spec.rb:2' }, - b: { example_id: 'spec/foo/baz_spec.rb:3', first_flaky_at: (Time.now - a_hundred_days).to_s, last_flaky_at: (Time.now - a_hundred_days).to_s } + b: { example_id: 'spec/foo/baz_spec.rb:3', first_flaky_at: (Time.now - thirty_one_days).to_s, last_flaky_at: (Time.now - thirty_one_days).to_s } } end let(:suite_flaky_example_report) do @@ -109,7 +109,7 @@ describe RspecFlaky::Report, :aggregate_failures do end describe '#prune_outdated' do - it 'returns a new collection without the examples older than 90 days by default' do + it 'returns a new collection without the examples older than 30 days by default' do new_report = flaky_examples.to_h.dup.tap { |r| r.delete(:b) } new_flaky_examples = report.prune_outdated @@ -119,7 +119,7 @@ describe RspecFlaky::Report, :aggregate_failures do end it 'accepts a given number of days' do - new_flaky_examples = report.prune_outdated(days: 200) + new_flaky_examples = report.prune_outdated(days: 32) expect(new_flaky_examples.to_h).to eq(report.to_h) end |