import { TestApp } from '@baserow/test/helpers/testApp' import Table from '@baserow/modules/database/components/table/Table' describe('Table views context events', () => { let testApp = null beforeEach(() => { testApp = new TestApp() }) afterEach(async () => { vi.restoreAllMocks() await testApp.afterEach() }) test('are ignored while the views are not loaded', async () => { vi.spyOn(Table.methods, 'refresh').mockResolvedValue() const view = { id: 1, type: 'grid', ownership_type: 'collaborative', filter_type: 'AND', filters_disabled: false, filters: [], filter_groups: [], sortings: [], group_bys: [], _: { type: testApp.store.$registry.get('view', 'grid').serialize() }, } const wrapper = await testApp.mount(Table, { props: { database: { id: 1, workspace: { id: 1 } }, table: { id: 1 }, fields: [], views: null, view, tableLoading: true, readOnly: true, }, }) expect(() => { wrapper.vm.$bus.$emit('open-table-views-context') wrapper.vm.$bus.$emit('close-table-views-context') }).not.toThrow() }) })