Commit b4b534af authored by Filipa Lacerda's avatar Filipa Lacerda

Adds tests to unsuccessful response

parent 0d22ab42
......@@ -76,4 +76,42 @@ describe('Deploy Board', () => {
}, 0);
});
});
describe('unsuccessfull request', () => {
const deployBoardErrorInterceptor = (request, next) => {
next(request.respondWith(JSON.stringify({}), {
status: 500,
}));
};
let component;
beforeEach(() => {
Vue.http.interceptors.push(deployBoardErrorInterceptor);
this.service = new Service('environments');
component = new DeployBoardComponent({
el: document.querySelector('.test-dom-element'),
propsData: {
store: {},
service: this.service,
deployBoardData: {},
environmentID: 1,
},
});
});
afterEach(() => {
Vue.http.interceptors = _.without(Vue.http.interceptors, deployBoardErrorInterceptor);
});
it('should render empty state', (done) => {
setTimeout(() => {
expect(component.$el.children.length,).toEqual(0);
done();
}, 0);
});
});
});
......@@ -36,6 +36,8 @@ describe('Environment item', () => {
size: 1,
environment_path: 'url',
id: 1,
rollout_status: 'url',
hasDeployBoard: true,
deployBoardData: {
instances: [
{ status: 'ready', tooltip: 'foo' },
......@@ -72,6 +74,8 @@ describe('Environment item', () => {
size: 1,
environment_path: 'url',
id: 1,
rollout_status: 'url',
hasDeployBoard: true,
deployBoardData: {
instances: [
{ status: 'ready', tooltip: 'foo' },
......
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