2017-05-05 14:23:31 -04:00
|
|
|
import Vue from 'vue';
|
|
|
|
import SidebarService from '~/sidebar/services/sidebar_service';
|
|
|
|
import Mock from './mock_data';
|
|
|
|
|
|
|
|
describe('Sidebar service', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
Vue.http.interceptors.push(Mock.sidebarMockInterceptor);
|
|
|
|
this.service = new SidebarService('/gitlab-org/gitlab-shell/issues/5.json');
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
SidebarService.singleton = null;
|
2017-05-09 08:34:08 -04:00
|
|
|
Vue.http.interceptors = _.without(Vue.http.interceptors, Mock.sidebarMockInterceptor);
|
2017-05-05 14:23:31 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
it('gets the data', (done) => {
|
2017-05-05 15:45:14 -04:00
|
|
|
this.service.get()
|
|
|
|
.then((resp) => {
|
|
|
|
expect(resp).toBeDefined();
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(() => {});
|
2017-05-05 14:23:31 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
it('updates the data', (done) => {
|
2017-05-05 15:45:14 -04:00
|
|
|
this.service.update('issue[assignee_ids]', [1])
|
|
|
|
.then((resp) => {
|
|
|
|
expect(resp).toBeDefined();
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(() => {});
|
2017-05-05 14:23:31 -04:00
|
|
|
});
|
|
|
|
});
|