Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a8508608
Commit
a8508608
authored
Nov 07, 2016
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes the tests
parent
26664203
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
142 additions
and
32 deletions
+142
-32
spec/javascripts/environments/environments_store_spec.js.es6
spec/javascripts/environments/environments_store_spec.js.es6
+13
-13
spec/javascripts/environments/mock_data.js.es6
spec/javascripts/environments/mock_data.js.es6
+129
-19
No files found.
spec/javascripts/environments/environments_store_spec.js.es6
View file @
a8508608
//= require vue
//= require vue
//= require environments/stores/environmnets_store
//= require environments/stores/environmnets_store
//= require ./mock_data
//= require ./mock_data
/* globals environmentsList */
(() => {
(() => {
beforeEach(() => {
beforeEach(() => {
gl.environmentsList.EnvironmentsStore.create();
gl.environmentsList.EnvironmentsStore.create();
});
});
...
@@ -12,12 +11,12 @@
...
@@ -12,12 +11,12 @@
it('should start with a blank state', () => {
it('should start with a blank state', () => {
expect(gl.environmentsList.EnvironmentsStore.state.environments.length).toBe(0);
expect(gl.environmentsList.EnvironmentsStore.state.environments.length).toBe(0);
expect(gl.environmentsList.EnvironmentsStore.state.stoppedCounter).toBe(0);
expect(gl.environmentsList.EnvironmentsStore.state.stoppedCounter).toBe(0);
expect(gl.environmentsList.EnvironmentsStore.state.availableCounter).toBe(0)
expect(gl.environmentsList.EnvironmentsStore.state.availableCounter).toBe(0)
;
});
});
describe('store environments', () => {
describe('store environments', () => {
beforeEach(() => {
beforeEach(() => {
gl.environmentsList.EnvironmentsStore.storeEnvironments(environmentsList);
gl.environmentsList.EnvironmentsStore.storeEnvironments(environmentsList);
});
});
it('should count stopped environments and save the count in the state', () => {
it('should count stopped environments and save the count in the state', () => {
...
@@ -25,29 +24,30 @@
...
@@ -25,29 +24,30 @@
});
});
it('should count available environments and save the count in the state', () => {
it('should count available environments and save the count in the state', () => {
expect(gl.environmentsList.EnvironmentsStore.state.availableCounter).toBe(
2
);
expect(gl.environmentsList.EnvironmentsStore.state.availableCounter).toBe(
3
);
});
});
it('should store environments with same environment_type as sibilings', () => {
it('should store environments with same environment_type as sibilings', () => {
expect(gl.environmentsList.EnvironmentsStore.state.environments.length).toBe(
2
);
expect(gl.environmentsList.EnvironmentsStore.state.environments.length).toBe(
3
);
const parentFolder = gl.environmentsList.EnvironmentsStore.state.environments.filter((env) => {
const parentFolder = gl.environmentsList.EnvironmentsStore.state.environments
return env.children && env.children.length > 0;
.filter(env => env.children && env.children.length > 0);
});
expect(parentFolder[0].children.length).toBe(2);
expect(parentFolder[0].children.length).toBe(2);
expect(parentFolder[0].children[0].environment_type).toBe('review');
expect(parentFolder[0].children[0].environment_type).toBe('review');
expect(parentFolder[0].children[1].environment_type).toBe('review');
expect(parentFolder[0].children[1].environment_type).toBe('review');
expect(parentFolder[0].children[0].name).toBe('
review/test-environment')
expect(parentFolder[0].children[0].name).toBe('
test-environment');
expect(parentFolder[0].children[1].name).toBe('
review/
test-environment-1');
expect(parentFolder[0].children[1].name).toBe('test-environment-1');
});
});
it('should sort the environments alphabetically', () => {
it('should sort the environments alphabetically', () => {
const { environments } = gl.environmentsList.EnvironmentsStore.state;
const { environments } = gl.environmentsList.EnvironmentsStore.state;
expect(environments[0].name).toBe('production');
expect(environments[0].name).toBe('production');
expect(environments[1].children[0].name).toBe('review/test-environment');
expect(environments[1].name).toBe('review');
expect(environments[1].children[1].name).toBe('review/test-environment-1');
expect(environments[1].children[0].name).toBe('test-environment');
expect(environments[1].children[1].name).toBe('test-environment-1');
expect(environments[2].name).toBe('review_app')
});
});
});
});
});
});
...
...
spec/javascripts/environments/mock_data.js.es6
View file @
a8508608
/* eslint-disable no-unused-vars */
const environmentsList = [
const environmentsList = [
{
{
"id": 15,
id: 31,
"project_id": 11,
name: 'production',
"name": "production",
state: 'available',
"external_url": "https://test.com",
external_url: 'https://www.gitlab.com',
"environment_type": null,
environment_type: null,
"state": "available"
last_deployment: {
id: 64,
iid: 5,
sha: '500aabcb17c97bdcf2d0c410b70cb8556f0362dd',
ref: {
name: 'master',
ref_url: 'http://localhost:3000/root/ci-folders/tree/master',
},
tag: false,
'last?': true,
user: {
name: 'Administrator',
username: 'root',
id: 1,
state: 'active',
avatar_url: 'http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon',
web_url: 'http://localhost:3000/root',
},
commit: {
id: '500aabcb17c97bdcf2d0c410b70cb8556f0362dd',
short_id: '500aabcb',
title: 'Update .gitlab-ci.yml',
author_name: 'Administrator',
author_email: 'admin@example.com',
created_at: '2016-11-07T18:28:13.000+00:00',
message: 'Update .gitlab-ci.yml',
author: {
name: 'Administrator',
username: 'root',
id: 1,
state: 'active',
avatar_url: 'http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon',
web_url: 'http://localhost:3000/root',
},
commit_url: 'http://localhost:3000/root/ci-folders/tree/500aabcb17c97bdcf2d0c410b70cb8556f0362dd',
},
deployable: {
id: 1278,
name: 'build',
build_url: 'http://localhost:3000/root/ci-folders/builds/1278',
retry_url: 'http://localhost:3000/root/ci-folders/builds/1278/retry',
},
manual_actions: [],
},
'stoppable?': true,
environment_url: 'http://localhost:3000/root/ci-folders/environments/31',
created_at: '2016-11-07T11:11:16.525Z',
updated_at: '2016-11-07T11:11:16.525Z',
},
},
{
{
"id": 18,
id: 32,
"project_id": 11,
name: 'review_app',
"name": "review/test-environment",
state: 'stopped',
"external_url": "http://test1.com",
external_url: 'https://www.gitlab.com',
"environment_type": "review",
environment_type: null,
"state": "available"
last_deployment: {
id: 64,
iid: 5,
sha: '500aabcb17c97bdcf2d0c410b70cb8556f0362dd',
ref: {
name: 'master',
ref_url: 'http://localhost:3000/root/ci-folders/tree/master',
},
tag: false,
'last?': true,
user: {
name: 'Administrator',
username: 'root',
id: 1,
state: 'active',
avatar_url: 'http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon',
web_url: 'http://localhost:3000/root',
},
commit: {
id: '500aabcb17c97bdcf2d0c410b70cb8556f0362dd',
short_id: '500aabcb',
title: 'Update .gitlab-ci.yml',
author_name: 'Administrator',
author_email: 'admin@example.com',
created_at: '2016-11-07T18:28:13.000+00:00',
message: 'Update .gitlab-ci.yml',
author: {
name: 'Administrator',
username: 'root',
id: 1,
state: 'active',
avatar_url: 'http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon',
web_url: 'http://localhost:3000/root',
},
commit_url: 'http://localhost:3000/root/ci-folders/tree/500aabcb17c97bdcf2d0c410b70cb8556f0362dd',
},
deployable: {
id: 1278,
name: 'build',
build_url: 'http://localhost:3000/root/ci-folders/builds/1278',
retry_url: 'http://localhost:3000/root/ci-folders/builds/1278/retry',
},
manual_actions: [],
},
'stoppable?': false,
environment_url: 'http://localhost:3000/root/ci-folders/environments/31',
created_at: '2016-11-07T11:11:16.525Z',
updated_at: '2016-11-07T11:11:16.525Z',
},
},
{
{
"id": 19,
id: 33,
"project_id": 11,
name: 'test-environment',
"name": "review/test-environment-1",
state: 'available',
"external_url": "http://test-1.com",
environment_type: 'review',
"environment_type": "review",
last_deployment: null,
"state": "stopped"
'stoppable?': true,
}
environment_url: 'http://localhost:3000/root/ci-folders/environments/31',
created_at: '2016-11-07T11:11:16.525Z',
updated_at: '2016-11-07T11:11:16.525Z',
},
{
id: 34,
name: 'test-environment-1',
state: 'available',
environment_type: 'review',
last_deployment: null,
'stoppable?': true,
environment_url: 'http://localhost:3000/root/ci-folders/environments/31',
created_at: '2016-11-07T11:11:16.525Z',
updated_at: '2016-11-07T11:11:16.525Z',
},
];
];
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment