Files
baserow/web-frontend/test/unit/database/components/export/exportTableModal.spec.js
716d43a9a8 Nuxt 3 migration (#4342)
Update the nuxt3 version.

Co-authored-by: Jonathan Adeline <jonathan@baserow.io>
Co-authored-by: Bram Wiepjes <bramw@protonmail.com>
Co-authored-by: Cezary <cezary@baserow.io>
Co-authored-by: Tsering Paljor <tsering@baserow.io>
Co-authored-by: Przemyslaw Kukulski <przemyslaw+gh@baserow.io>
Co-authored-by: Bram <bram2w@users.noreply.github.com>
2026-01-22 10:27:19 +01:00

61 lines
1.6 KiB
JavaScript

import { TestApp } from '@baserow/test/helpers/testApp'
import ExportTableModal from '@baserow/modules/database/components/export/ExportTableModal'
describe('Preview exportTableModal', () => {
let testApp = null
let mockServer = null
beforeEach(() => {
testApp = new TestApp()
mockServer = testApp.mockServer
})
afterEach(() => {
testApp.afterEach()
})
async function givenThereIsATableWithView() {
let table = mockServer.createTable()
const database = { tables: [], workspace: { id: 0 } }
table = await testApp.store.dispatch('table/forceUpsert', {
database,
data: table,
})
const view = mockServer.createGridView(database, table, {})
return { database, table, view }
}
test('Modal with no view', async () => {
const { table, database } = await givenThereIsATableWithView()
const wrapper = await testApp.mount(ExportTableModal, {
propsData: {
database,
table,
view: null,
},
})
await wrapper.vm.show()
expect(wrapper.element).toMatchSnapshot()
expect(wrapper.html()).toContain(`exportTableModal.title`)
expect(wrapper.find('.select__item.active').html()).toContain(
'exportEntireTable'
)
})
test('Modal with view', async () => {
const { table, view, database } = await givenThereIsATableWithView()
const wrapper = await testApp.mount(ExportTableModal, {
propsData: {
database,
table,
view,
},
})
await wrapper.vm.show()
expect(wrapper.element).toMatchSnapshot()
expect(wrapper.find('.select__item.active').html()).toContain(
`${view.name}`
)
})
})