Commit f1d48c25 authored by Clement Ho's avatar Clement Ho

Fix failing spec and eslint

parent 48e49919
......@@ -4,7 +4,7 @@ export default {
for (let i = 0; i < numberUsers; i = i += 1) {
users.push(
{
avatarUrl: 'http://gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
avatar: 'http://gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
id: (i + 1),
name: `GitLab User ${i}`,
username: `gitlab${i}`,
......
import Vue from 'vue';
import Assignee from '~/sidebar/components/assignees/assignees';
import UsersMock from './mock_data';
import UsersMockHelper from '../test_helpers/user_mock_data';
import UsersMockHelper from '../helpers/user_mock_data_helper';
describe('Assignee component', () => {
let component;
......@@ -86,7 +86,7 @@ describe('Assignee component', () => {
const collapsed = component.$el.querySelector('.sidebar-collapsed-icon');
const assignee = collapsed.children[0];
expect(collapsed.childElementCount).toEqual(1);
expect(assignee.querySelector('.avatar').getAttribute('src')).toEqual(UsersMock.user.avatarUrl);
expect(assignee.querySelector('.avatar').getAttribute('src')).toEqual(UsersMock.user.avatar);
expect(assignee.querySelector('.avatar').getAttribute('alt')).toEqual(`${UsersMock.user.name}'s avatar`);
expect(assignee.querySelector('.author').innerText.trim()).toEqual(UsersMock.user.name);
});
......@@ -104,7 +104,7 @@ describe('Assignee component', () => {
expect(component.$el.querySelector('.author_link')).not.toBeNull();
// The image
expect(component.$el.querySelector('.author_link img').getAttribute('src')).toEqual(UsersMock.user.avatarUrl);
expect(component.$el.querySelector('.author_link img').getAttribute('src')).toEqual(UsersMock.user.avatar);
// Author name
expect(component.$el.querySelector('.author_link .author').innerText.trim()).toEqual(UsersMock.user.name);
// Username
......@@ -141,12 +141,12 @@ describe('Assignee component', () => {
expect(collapsed.childElementCount).toEqual(2);
const first = collapsed.children[0];
expect(first.querySelector('.avatar').getAttribute('src')).toEqual(users[0].avatarUrl);
expect(first.querySelector('.avatar').getAttribute('src')).toEqual(users[0].avatar);
expect(first.querySelector('.avatar').getAttribute('alt')).toEqual(`${users[0].name}'s avatar`);
expect(first.querySelector('.author').innerText.trim()).toEqual(users[0].name);
const second = collapsed.children[1];
expect(second.querySelector('.avatar').getAttribute('src')).toEqual(users[1].avatarUrl);
expect(second.querySelector('.avatar').getAttribute('src')).toEqual(users[1].avatar);
expect(second.querySelector('.avatar').getAttribute('alt')).toEqual(`${users[1].name}'s avatar`);
expect(second.querySelector('.author').innerText.trim()).toEqual(users[1].name);
});
......@@ -165,7 +165,7 @@ describe('Assignee component', () => {
expect(collapsed.childElementCount).toEqual(2);
const first = collapsed.children[0];
expect(first.querySelector('.avatar').getAttribute('src')).toEqual(users[0].avatarUrl);
expect(first.querySelector('.avatar').getAttribute('src')).toEqual(users[0].avatar);
expect(first.querySelector('.avatar').getAttribute('alt')).toEqual(`${users[0].name}'s avatar`);
expect(first.querySelector('.author').innerText.trim()).toEqual(users[0].name);
......
......@@ -93,7 +93,7 @@ export default {
human_total_time_spent: null,
},
user: {
avatarUrl: 'http://gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
avatar: 'http://gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon',
id: 1,
name: 'Administrator',
username: 'root',
......
......@@ -24,10 +24,12 @@ describe('Sidebar mediator', () => {
});
it('saves assignees', (done) => {
this.mediator.saveAssignees('issue[assignee_ids]').then((resp) => {
this.mediator.saveAssignees('issue[assignee_ids]')
.then((resp) => {
expect(resp.status).toEqual(200);
done();
});
})
.catch(() => {});
});
it('fetches the data', () => {
......
......@@ -13,16 +13,20 @@ describe('Sidebar service', () => {
});
it('gets the data', (done) => {
this.service.get().then((resp) => {
this.service.get()
.then((resp) => {
expect(resp).toBeDefined();
done();
});
})
.catch(() => {});
});
it('updates the data', (done) => {
this.service.update('issue[assignee_ids]', [1]).then((resp) => {
this.service.update('issue[assignee_ids]', [1])
.then((resp) => {
expect(resp).toBeDefined();
done();
});
})
.catch(() => {});
});
});
import SidebarStore from '~/sidebar/stores/sidebar_store';
import Mock from './mock_data';
import UsersMockHelper from '../test_helpers/user_mock_data';
import UsersMockHelper from '../helpers/user_mock_data_helper';
describe('Sidebar store', () => {
const assignee = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment