Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-02 00:07:56 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-02 00:07:56 +0300
commit0e68afab211a172b862a7acc774e1eda5da8e471 (patch)
tree1eba04a16582c9183d4f479f82dd8709ae40d72f /spec/frontend
parent33aa02e7a38d8dfc5e470dd5d776c8d4ce5b2dd5 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
-rw-r--r--spec/frontend/monitoring/components/dashboard_spec.js16
-rw-r--r--spec/frontend/monitoring/components/embeds/metric_embed_spec.js3
-rw-r--r--spec/frontend/monitoring/store/actions_spec.js10
-rw-r--r--spec/frontend/monitoring/store/mutations_spec.js52
-rw-r--r--spec/frontend/releases/components/release_block_spec.js8
5 files changed, 77 insertions, 12 deletions
diff --git a/spec/frontend/monitoring/components/dashboard_spec.js b/spec/frontend/monitoring/components/dashboard_spec.js
index b9d838085a1..ec25c9e169a 100644
--- a/spec/frontend/monitoring/components/dashboard_spec.js
+++ b/spec/frontend/monitoring/components/dashboard_spec.js
@@ -88,11 +88,17 @@ describe('Dashboard', () => {
expect(findEnvironmentsDropdown().exists()).toBe(true);
});
- it('sets endpoints: logs path', () => {
- expect(store.dispatch).toHaveBeenCalledWith(
- 'monitoringDashboard/setEndpoints',
- expect.objectContaining({ logsPath: propsData.logsPath }),
- );
+ it('sets initial state', () => {
+ expect(store.dispatch).toHaveBeenCalledWith('monitoringDashboard/setInitialState', {
+ currentDashboard: '',
+ currentEnvironmentName: 'production',
+ dashboardEndpoint: 'https://invalid',
+ dashboardsEndpoint: 'https://invalid',
+ deploymentsEndpoint: null,
+ logsPath: '/path/to/logs',
+ metricsEndpoint: 'http://test.host/monitoring/mock',
+ projectPath: '/path/to/project',
+ });
});
});
diff --git a/spec/frontend/monitoring/components/embeds/metric_embed_spec.js b/spec/frontend/monitoring/components/embeds/metric_embed_spec.js
index d0fe22cefec..b829cd53479 100644
--- a/spec/frontend/monitoring/components/embeds/metric_embed_spec.js
+++ b/spec/frontend/monitoring/components/embeds/metric_embed_spec.js
@@ -26,9 +26,8 @@ describe('MetricEmbed', () => {
beforeEach(() => {
actions = {
- setFeatureFlags: jest.fn(),
+ setInitialState: jest.fn(),
setShowErrorBanner: jest.fn(),
- setEndpoints: jest.fn(),
setTimeRange: jest.fn(),
fetchDashboard: jest.fn(),
};
diff --git a/spec/frontend/monitoring/store/actions_spec.js b/spec/frontend/monitoring/store/actions_spec.js
index 203bc6f4e0e..e9f9aa0ba18 100644
--- a/spec/frontend/monitoring/store/actions_spec.js
+++ b/spec/frontend/monitoring/store/actions_spec.js
@@ -16,7 +16,7 @@ import {
fetchEnvironmentsData,
fetchPrometheusMetrics,
fetchPrometheusMetric,
- setEndpoints,
+ setInitialState,
filterEnvironments,
setGettingStartedEmptyState,
duplicateSystemDashboard,
@@ -208,14 +208,14 @@ describe('Monitoring store actions', () => {
});
});
- describe('Set endpoints', () => {
+ describe('Set initial state', () => {
let mockedState;
beforeEach(() => {
mockedState = storeState();
});
- it('should commit SET_ENDPOINTS mutation', done => {
+ it('should commit SET_INITIAL_STATE mutation', done => {
testAction(
- setEndpoints,
+ setInitialState,
{
metricsEndpoint: 'additional_metrics.json',
deploymentsEndpoint: 'deployments.json',
@@ -223,7 +223,7 @@ describe('Monitoring store actions', () => {
mockedState,
[
{
- type: types.SET_ENDPOINTS,
+ type: types.SET_INITIAL_STATE,
payload: {
metricsEndpoint: 'additional_metrics.json',
deploymentsEndpoint: 'deployments.json',
diff --git a/spec/frontend/monitoring/store/mutations_spec.js b/spec/frontend/monitoring/store/mutations_spec.js
index 5a79b8ef49c..0310c7e9510 100644
--- a/spec/frontend/monitoring/store/mutations_spec.js
+++ b/spec/frontend/monitoring/store/mutations_spec.js
@@ -86,6 +86,58 @@ describe('Monitoring mutations', () => {
expect(typeof stateCopy.deploymentData[0]).toEqual('object');
});
});
+
+ describe('SET_INITIAL_STATE', () => {
+ it('should set all the endpoints', () => {
+ mutations[types.SET_INITIAL_STATE](stateCopy, {
+ metricsEndpoint: 'additional_metrics.json',
+ deploymentsEndpoint: 'deployments.json',
+ dashboardEndpoint: 'dashboard.json',
+ projectPath: '/gitlab-org/gitlab-foss',
+ currentEnvironmentName: 'production',
+ });
+ expect(stateCopy.metricsEndpoint).toEqual('additional_metrics.json');
+ expect(stateCopy.deploymentsEndpoint).toEqual('deployments.json');
+ expect(stateCopy.dashboardEndpoint).toEqual('dashboard.json');
+ expect(stateCopy.projectPath).toEqual('/gitlab-org/gitlab-foss');
+ expect(stateCopy.currentEnvironmentName).toEqual('production');
+ });
+
+ it('should not remove previously set properties', () => {
+ const defaultLogsPath = stateCopy.logsPath;
+
+ mutations[types.SET_INITIAL_STATE](stateCopy, {
+ logsPath: defaultLogsPath,
+ });
+ mutations[types.SET_INITIAL_STATE](stateCopy, {
+ dashboardEndpoint: 'dashboard.json',
+ });
+ mutations[types.SET_INITIAL_STATE](stateCopy, {
+ projectPath: '/gitlab-org/gitlab-foss',
+ });
+ mutations[types.SET_INITIAL_STATE](stateCopy, {
+ currentEnvironmentName: 'canary',
+ });
+
+ expect(stateCopy).toMatchObject({
+ logsPath: defaultLogsPath,
+ dashboardEndpoint: 'dashboard.json',
+ projectPath: '/gitlab-org/gitlab-foss',
+ currentEnvironmentName: 'canary',
+ });
+ });
+
+ it('should not update unknown properties', () => {
+ mutations[types.SET_INITIAL_STATE](stateCopy, {
+ dashboardEndpoint: 'dashboard.json',
+ someOtherProperty: 'some invalid value', // someOtherProperty is not allowed
+ });
+
+ expect(stateCopy.dashboardEndpoint).toBe('dashboard.json');
+ expect(stateCopy.someOtherProperty).toBeUndefined();
+ });
+ });
+
describe('SET_ENDPOINTS', () => {
it('should set all the endpoints', () => {
mutations[types.SET_ENDPOINTS](stateCopy, {
diff --git a/spec/frontend/releases/components/release_block_spec.js b/spec/frontend/releases/components/release_block_spec.js
index 7ea2379ea35..9846fcb65eb 100644
--- a/spec/frontend/releases/components/release_block_spec.js
+++ b/spec/frontend/releases/components/release_block_spec.js
@@ -165,6 +165,14 @@ describe('Release block', () => {
});
});
+ it('does not set the ID if tagName is missing', () => {
+ release.tagName = undefined;
+
+ return factory(release).then(() => {
+ expect(wrapper.attributes().id).toBeUndefined();
+ });
+ });
+
describe('evidence block', () => {
it('renders the evidence block when the evidence is available and the feature flag is true', () =>
factory(release, { releaseEvidenceCollection: true }).then(() =>