debian-mirror-gitlab/spec/javascripts/registry/components/table_registry_spec.js

50 lines
1.4 KiB
JavaScript
Raw Normal View History

2018-03-17 18:26:18 +05:30
import Vue from 'vue';
import tableRegistry from '~/registry/components/table_registry.vue';
import store from '~/registry/stores';
import { repoPropsData } from '../mock_data';
describe('table registry', () => {
let vm;
let Component;
beforeEach(() => {
Component = Vue.extend(tableRegistry);
vm = new Component({
store,
propsData: {
repo: repoPropsData,
},
}).$mount();
});
afterEach(() => {
vm.$destroy();
});
it('should render a table with the registry list', () => {
2018-12-13 13:39:08 +05:30
expect(vm.$el.querySelectorAll('table tbody tr').length).toEqual(repoPropsData.list.length);
2018-03-17 18:26:18 +05:30
});
it('should render registry tag', () => {
2018-12-13 13:39:08 +05:30
const textRendered = vm.$el
.querySelector('.table tbody tr')
.textContent.trim()
.replace(/\s\s+/g, ' ');
2018-03-17 18:26:18 +05:30
expect(textRendered).toContain(repoPropsData.list[0].tag);
expect(textRendered).toContain(repoPropsData.list[0].shortRevision);
expect(textRendered).toContain(repoPropsData.list[0].layers);
expect(textRendered).toContain(repoPropsData.list[0].size);
});
it('should be possible to delete a registry', () => {
2018-12-13 13:39:08 +05:30
expect(vm.$el.querySelector('.table tbody tr .js-delete-registry')).toBeDefined();
2018-03-17 18:26:18 +05:30
});
describe('pagination', () => {
it('should be possible to change the page', () => {
expect(vm.$el.querySelector('.gl-pagination')).toBeDefined();
});
});
});