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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
605195c2
Commit
605195c2
authored
Feb 16, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix broken tests
parent
9ac8bf2c
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
98 additions
and
77 deletions
+98
-77
app/assets/javascripts/environments/stores/environments_store.js.es6
...javascripts/environments/stores/environments_store.js.es6
+2
-2
spec/javascripts/environments/environment_item_spec.js.es6
spec/javascripts/environments/environment_item_spec.js.es6
+56
-59
spec/javascripts/environments/environments_store_spec.js.es6
spec/javascripts/environments/environments_store_spec.js.es6
+4
-3
spec/javascripts/environments/folder/environments_folder_view_spec.js.es6
.../environments/folder/environments_folder_view_spec.js.es6
+3
-13
spec/javascripts/environments/mock_data.js.es6
spec/javascripts/environments/mock_data.js.es6
+33
-0
No files found.
app/assets/javascripts/environments/stores/environments_store.js.es6
View file @
605195c2
...
...
@@ -38,11 +38,11 @@ class EnvironmentsStore {
let filtered = {};
if (env.size > 1) {
filtered = Object.assign({}, env, { isFolder: true });
filtered = Object.assign({}, env, { isFolder: true
, folderName: env.name
});
}
if (env.latest) {
filtered = Object.assign(filtered, env, env.latest
, { folderName: env.name }
);
filtered = Object.assign(filtered, env, env.latest);
delete filtered.latest;
} else {
filtered = Object.assign(filtered, env);
...
...
spec/javascripts/environments/environment_item_spec.js.es6
View file @
605195c2
...
...
@@ -14,11 +14,10 @@ describe('Environment item', () => {
beforeEach(() => {
mockItem = {
name: 'review',
folderName: 'review',
size: 3,
isFolder: true,
latest: {
environment_path: 'url',
},
};
component = new EnvironmentItem({
...
...
@@ -49,7 +48,6 @@ describe('Environment item', () => {
environment = {
name: 'production',
size: 1,
latest: {
state: 'stopped',
external_url: 'http://external.com',
environment_type: null,
...
...
@@ -108,7 +106,6 @@ describe('Environment item', () => {
environment_path: 'root/ci-folders/environments/31',
created_at: '2016-11-07T11:11:16.525Z',
updated_at: '2016-11-10T15:55:58.778Z',
},
};
component = new EnvironmentItem({
...
...
@@ -129,7 +126,7 @@ describe('Environment item', () => {
it('should render deployment internal id', () => {
expect(
component.$el.querySelector('.deployment-column span').textContent,
).toContain(environment.la
test.la
st_deployment.iid);
).toContain(environment.last_deployment.iid);
expect(
component.$el.querySelector('.deployment-column span').textContent,
...
...
@@ -139,7 +136,7 @@ describe('Environment item', () => {
it('should render last deployment date', () => {
const timeagoInstance = new timeago(); // eslint-disable-line
const formatedDate = timeagoInstance.format(
environment.la
test.la
st_deployment.deployable.created_at,
environment.last_deployment.deployable.created_at,
);
expect(
...
...
@@ -151,7 +148,7 @@ describe('Environment item', () => {
it('should render user avatar with link to profile', () => {
expect(
component.$el.querySelector('.js-deploy-user-container').getAttribute('href'),
).toEqual(environment.la
test.la
st_deployment.user.web_url);
).toEqual(environment.last_deployment.user.web_url);
});
});
...
...
@@ -159,13 +156,13 @@ describe('Environment item', () => {
it('Should link to build url provided', () => {
expect(
component.$el.querySelector('.build-link').getAttribute('href'),
).toEqual(environment.la
test.la
st_deployment.deployable.build_path);
).toEqual(environment.last_deployment.deployable.build_path);
});
it('Should render deployable name and id', () => {
expect(
component.$el.querySelector('.build-link').getAttribute('href'),
).toEqual(environment.la
test.la
st_deployment.deployable.build_path);
).toEqual(environment.last_deployment.deployable.build_path);
});
});
...
...
spec/javascripts/environments/environments_store_spec.js.es6
View file @
605195c2
const Store = require('~/environments/stores/environments_store');
const { environmentsList } = require('./mock_data');
const { environmentsList
, serverData
} = require('./mock_data');
(() => {
describe('Store', () => {
...
...
@@ -17,8 +17,9 @@ const { environmentsList } = require('./mock_data');
});
it('should store environments', () => {
store.storeEnvironments(environmentsList);
expect(store.state.environments.length).toEqual(environmentsList.length);
store.storeEnvironments(serverData);
expect(store.state.environments.length).toEqual(serverData.length);
expect(store.state.environments[0]).toEqual(environmentsList[0]);
});
it('should store available count', () => {
...
...
spec/javascripts/environments/folder/environments_folder_view_spec.js.es6
View file @
605195c2
...
...
@@ -8,7 +8,7 @@ describe('Environments Folder View', () => {
beforeEach(() => {
loadFixtures('static/environments/environments_folder_view.html.raw');
window.history.pushState({}, null, 'environments/folders/
51
');
window.history.pushState({}, null, 'environments/folders/
build
');
});
let component;
...
...
@@ -80,12 +80,11 @@ describe('Environments Folder View', () => {
}, 0);
});
// FIX ME:
it('should render parent folder name', (done) => {
setTimeout(() => {
expect(
component.$el.querySelector('.js-folder-name'),
).to
Be(null
);
component.$el.querySelector('.js-folder-name')
.textContent
,
).to
Contain('Environments / build'
);
done();
}, 0);
});
...
...
@@ -199,14 +198,5 @@ describe('Environments Folder View', () => {
done();
}, 0);
});
it('should not render parent folder name', (done) => {
setTimeout(() => {
expect(
component.$el.querySelector('.js-folder-name'),
).toBe(null);
done();
}, 0);
});
});
});
spec/javascripts/environments/mock_data.js.es6
View file @
605195c2
const environmentsList = [
{
name: 'DEV',
size: 1,
id: 7,
state: 'available',
external_url: null,
environment_type: null,
last_deployment: null,
'stop_action?': false,
environment_path: '/root/review-app/environments/7',
stop_path: '/root/review-app/environments/7/stop',
created_at: '2017-01-31T10:53:46.894Z',
updated_at: '2017-01-31T10:53:46.894Z',
},
{
folderName: 'build',
size: 5,
id: 12,
name: 'build/update-README',
state: 'available',
external_url: null,
environment_type: 'build',
last_deployment: null,
'stop_action?': false,
environment_path: '/root/review-app/environments/12',
stop_path: '/root/review-app/environments/12/stop',
created_at: '2017-02-01T19:42:18.400Z',
updated_at: '2017-02-01T19:42:18.400Z',
},
];
const serverData = [
{
name: 'DEV',
size: 1,
...
...
@@ -56,4 +88,5 @@ const environment = {
module.exports = {
environmentsList,
environment,
serverData,
};
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