Skip to content
Snippets Groups Projects
Commit 4720b569 authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent cefe554b
No related branches found
No related tags found
No related merge requests found
Showing with 502 additions and 351 deletions
# frozen_string_literal: true
 
module QA
context 'Create', :smoke, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/issues/205511', type: :bug } do
context 'Create', :smoke do
describe 'Snippet creation' do
it 'User creates a snippet' do
Flow::Login.sign_in
Loading
Loading
Loading
Loading
@@ -6,6 +6,12 @@ plugins:
extends:
- 'plugin:jest/recommended'
settings:
# We have to teach eslint-plugin-import what node modules we use
# otherwise there is an error when it tries to resolve them
import/core-modules:
- events
- fs
- path
import/resolver:
jest:
jestConfigFile: 'jest.config.js'
Loading
Loading
/* eslint-disable arrow-body-style */
import $ from 'jquery';
import GlFieldErrors from '~/gl_field_errors';
 
Loading
Loading
Loading
Loading
@@ -358,6 +358,45 @@ describe('Time series component', () => {
expect(optionSeries[0].name).toEqual(mockSeriesName);
});
});
it('additional y axis data', () => {
const mockCustomYAxisOption = {
name: 'Custom y axis label',
axisLabel: {
formatter: jest.fn(),
},
};
timeSeriesChart.setProps({
option: {
yAxis: mockCustomYAxisOption,
},
});
return timeSeriesChart.vm.$nextTick().then(() => {
const { yAxis } = getChartOptions();
expect(yAxis[0]).toMatchObject(mockCustomYAxisOption);
});
});
it('additional x axis data', () => {
const mockCustomXAxisOption = {
name: 'Custom x axis label',
};
timeSeriesChart.setProps({
option: {
xAxis: mockCustomXAxisOption,
},
});
return timeSeriesChart.vm.$nextTick().then(() => {
const { xAxis } = getChartOptions();
expect(xAxis).toMatchObject(mockCustomXAxisOption);
});
});
});
 
describe('yAxis formatter', () => {
Loading
Loading
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Registry Breadcrumb when is rootRoute renders 1`] = `
<ul>
<li
class="foo bar"
>
baz
</li>
<li
class="foo bar"
>
foo
</li>
<!---->
<li>
<a
class="foo"
>
<a>
</a>
</a>
</li>
</ul>
`;
import { shallowMount } from '@vue/test-utils';
import component from '~/registry/explorer/components/registry_breadcrumb.vue';
describe('Registry Breadcrumb', () => {
let wrapper;
const nameGenerator = jest.fn();
const crumb = {
classList: ['foo', 'bar'],
tagName: 'div',
innerHTML: 'baz',
querySelector: jest.fn(),
children: [
{
tagName: 'a',
classList: ['foo'],
},
],
};
const querySelectorReturnValue = {
classList: ['js-divider'],
tagName: 'svg',
innerHTML: 'foo',
};
const crumbs = [crumb, { ...crumb, innerHTML: 'foo' }, { ...crumb, classList: ['baz'] }];
const routes = [
{ name: 'foo', meta: { nameGenerator, root: true } },
{ name: 'baz', meta: { nameGenerator } },
];
const findDivider = () => wrapper.find('.js-divider');
const findRootRoute = () => wrapper.find({ ref: 'rootRouteLink' });
const findChildRoute = () => wrapper.find({ ref: 'childRouteLink' });
const findLastCrumb = () => wrapper.find({ ref: 'lastCrumb' });
const mountComponent = $route => {
wrapper = shallowMount(component, {
propsData: {
crumbs,
},
stubs: {
'router-link': { name: 'router-link', template: '<a><slot></slot></a>', props: ['to'] },
},
mocks: {
$route,
$router: {
options: {
routes,
},
},
},
});
};
beforeEach(() => {
nameGenerator.mockClear();
crumb.querySelector = jest.fn();
});
afterEach(() => {
wrapper.destroy();
wrapper = null;
});
describe('when is rootRoute', () => {
beforeEach(() => {
mountComponent(routes[0]);
});
it('renders', () => {
expect(wrapper.element).toMatchSnapshot();
});
it('contains a router-link for the child route', () => {
expect(findChildRoute().exists()).toBe(true);
});
it('the link text is calculated by nameGenerator', () => {
expect(nameGenerator).toHaveBeenCalledWith(routes[0]);
expect(nameGenerator).toHaveBeenCalledTimes(1);
});
});
describe('when is not rootRoute', () => {
beforeEach(() => {
crumb.querySelector.mockReturnValue(querySelectorReturnValue);
mountComponent(routes[1]);
});
it('renders a divider', () => {
expect(findDivider().exists()).toBe(true);
});
it('contains a router-link for the root route', () => {
expect(findRootRoute().exists()).toBe(true);
});
it('contains a router-link for the child route', () => {
expect(findChildRoute().exists()).toBe(true);
});
it('the link text is calculated by nameGenerator', () => {
expect(nameGenerator).toHaveBeenCalledWith(routes[1]);
expect(nameGenerator).toHaveBeenCalledTimes(2);
});
});
describe('last crumb', () => {
const lastChildren = crumb.children[0];
beforeEach(() => {
nameGenerator.mockReturnValue('foo');
mountComponent(routes[0]);
});
it('has the same tag as the last children of the crumbs', () => {
expect(findLastCrumb().is(lastChildren.tagName)).toBe(true);
});
it('has the same classes as the last children of the crumbs', () => {
expect(findLastCrumb().classes()).toEqual(lastChildren.classList);
});
it('has a link to the current route', () => {
expect(findChildRoute().props('to')).toEqual({ to: routes[0].name });
});
it('the link has the correct text', () => {
expect(findChildRoute().text()).toEqual('foo');
});
});
});
Loading
Loading
@@ -254,7 +254,7 @@ describe('Details Page', () => {
return wrapper.vm.$nextTick().then(() => {
expect(store.dispatch).toHaveBeenCalledWith('requestDeleteTag', {
tag: store.state.tags[0],
imageId: wrapper.vm.$route.params.id,
params: wrapper.vm.$route.params.id,
});
// itemsToBeDeleted is not represented in the DOM, is used as parking variable between selected and deleted items
expect(wrapper.vm.itemsToBeDeleted).toEqual([]);
Loading
Loading
@@ -271,7 +271,7 @@ describe('Details Page', () => {
return wrapper.vm.$nextTick().then(() => {
expect(store.dispatch).toHaveBeenCalledWith('requestDeleteTags', {
ids: store.state.tags.map(t => t.name),
imageId: wrapper.vm.$route.params.id,
params: wrapper.vm.$route.params.id,
});
// itemsToBeDeleted is not represented in the DOM, is used as parking variable between selected and deleted items
expect(wrapper.vm.itemsToBeDeleted).toEqual([]);
Loading
Loading
Loading
Loading
@@ -121,14 +121,14 @@ describe('Actions RegistryExplorer Store', () => {
 
describe('fetch tags list', () => {
const url = `${endpoint}/1}`;
const path = window.btoa(JSON.stringify({ tags_path: `${endpoint}/1}` }));
const params = window.btoa(JSON.stringify({ tags_path: `${endpoint}/1}` }));
 
it('sets the tagsList', done => {
mock.onGet(url).replyOnce(200, registryServerResponse, {});
 
testAction(
actions.requestTagsList,
{ id: path },
{ params },
{},
[
{ type: types.SET_MAIN_LOADING, payload: true },
Loading
Loading
@@ -147,7 +147,7 @@ describe('Actions RegistryExplorer Store', () => {
it('should create flash on error', done => {
testAction(
actions.requestTagsList,
{ id: path },
{ params },
{},
[
{ type: types.SET_MAIN_LOADING, payload: true },
Loading
Loading
@@ -165,7 +165,7 @@ describe('Actions RegistryExplorer Store', () => {
describe('request delete single tag', () => {
it('successfully performs the delete request', done => {
const deletePath = 'delete/path';
const url = window.btoa(`${endpoint}/1}`);
const params = window.btoa(JSON.stringify({ tags_path: `${endpoint}/1}`, id: 1 }));
 
mock.onDelete(deletePath).replyOnce(200);
 
Loading
Loading
@@ -175,7 +175,7 @@ describe('Actions RegistryExplorer Store', () => {
tag: {
destroy_path: deletePath,
},
imageId: url,
params,
},
{
tagsPagination: {},
Loading
Loading
@@ -187,7 +187,7 @@ describe('Actions RegistryExplorer Store', () => {
[
{
type: 'requestTagsList',
payload: { pagination: {}, id: url },
payload: { pagination: {}, params },
},
],
() => {
Loading
Loading
@@ -220,9 +220,10 @@ describe('Actions RegistryExplorer Store', () => {
});
 
describe('request delete multiple tags', () => {
const imageId = 1;
const id = 1;
const params = window.btoa(JSON.stringify({ id }));
const projectPath = 'project-path';
const url = `${projectPath}/registry/repository/${imageId}/tags/bulk_destroy`;
const url = `${projectPath}/registry/repository/${id}/tags/bulk_destroy`;
 
it('successfully performs the delete request', done => {
mock.onDelete(url).replyOnce(200);
Loading
Loading
@@ -231,7 +232,7 @@ describe('Actions RegistryExplorer Store', () => {
actions.requestDeleteTags,
{
ids: [1, 2],
imageId,
params,
},
{
config: {
Loading
Loading
@@ -246,7 +247,7 @@ describe('Actions RegistryExplorer Store', () => {
[
{
type: 'requestTagsList',
payload: { pagination: {}, id: 1 },
payload: { pagination: {}, params },
},
],
() => {
Loading
Loading
@@ -263,7 +264,7 @@ describe('Actions RegistryExplorer Store', () => {
actions.requestDeleteTags,
{
ids: [1, 2],
imageId,
params,
},
{
config: {
Loading
Loading
Loading
Loading
@@ -18,7 +18,7 @@ describe('IssueAssigneesComponent', () => {
...props,
},
});
vm = wrapper.vm; // eslint-disable-line
vm = wrapper.vm;
};
 
const findTooltipText = () => wrapper.find('.js-assignee-tooltip').text();
Loading
Loading
Loading
Loading
@@ -588,4 +588,14 @@ describe Gitlab::Git::Blob, :seed_helper do
end
end
end
describe 'metrics' do
it 'defines :gitlab_blob_truncated_true counter' do
expect(described_class).to respond_to(:gitlab_blob_truncated_true)
end
it 'defines :gitlab_blob_truncated_false counter' do
expect(described_class).to respond_to(:gitlab_blob_truncated_false)
end
end
end
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment