Commit c24b7068 authored by Alfredo Sumaran's avatar Alfredo Sumaran

Add tests when user has no direct acces to a group

parent f427bf42
...@@ -94,7 +94,7 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -94,7 +94,7 @@ document.addEventListener('DOMContentLoaded', () => {
this.isLoading = false; this.isLoading = false;
$.scrollTo(0); $.scrollTo(0);
const currentPath = gl.utils.mergeUrlParams({ page: page }, window.location.href); const currentPath = gl.utils.mergeUrlParams({ page }, window.location.href);
window.history.replaceState({ window.history.replaceState({
page: currentPath, page: currentPath,
}, document.title, currentPath); }, document.title, currentPath);
......
...@@ -63,9 +63,40 @@ describe('Groups Component', () => { ...@@ -63,9 +63,40 @@ describe('Groups Component', () => {
}); });
}); });
afterEach(() => {
component.$destroy();
});
it('should render group item correctly', () => { it('should render group item correctly', () => {
expect(component.$el.querySelector('.description').textContent).toBe(''); expect(component.$el.querySelector('.description').textContent).toBe('');
expect(component.$el.classList.contains('.no-description')).toBe(false); expect(component.$el.classList.contains('.no-description')).toBe(false);
}); });
}); });
describe('user has not access to group', () => {
beforeEach((done) => {
GroupItemComponent = Vue.extend(groupItemComponent);
store = new GroupsStore();
group1.permissions.human_group_access = null;
group = store.decorateGroup(group1);
component = new GroupItemComponent({
propsData: {
group,
},
}).$mount();
Vue.nextTick(() => {
done();
});
});
afterEach(() => {
component.$destroy();
});
it('should not display access type', () => {
expect(component.$el.querySelector('.access-type')).toBeNull();
});
});
}); });
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