mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 00:08:25 +00:00
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>
62 lines
1.7 KiB
JavaScript
62 lines
1.7 KiB
JavaScript
import WebhookForm from '@baserow/modules/database/components/webhook/WebhookForm'
|
|
import { TestApp } from '@baserow/test/helpers/testApp'
|
|
|
|
describe('Webhook form Input Tests', () => {
|
|
let testApp = null
|
|
|
|
beforeEach(() => {
|
|
testApp = new TestApp()
|
|
})
|
|
|
|
afterEach(() => {
|
|
testApp.afterEach()
|
|
})
|
|
|
|
function mountWebhookForm() {
|
|
return testApp.mount(WebhookForm, {
|
|
propsData: {
|
|
table: { id: 1 },
|
|
database: { id: 2, workspace: { id: 3 } },
|
|
fields: [{ id: 1, name: 'Name', type: 'text' }],
|
|
views: [],
|
|
},
|
|
})
|
|
}
|
|
|
|
async function changeURL(wrapper, urlValue) {
|
|
const urlInput = wrapper.find(
|
|
'input[placeholder="webhookForm.inputLabels.url"]'
|
|
)
|
|
|
|
urlInput.element.value = urlValue
|
|
await urlInput.trigger('input')
|
|
await urlInput.trigger('blur')
|
|
}
|
|
|
|
test('WebhookForm displays an error on missing URL', async () => {
|
|
const wrapper = await mountWebhookForm()
|
|
await changeURL(wrapper, '')
|
|
|
|
wrapper.vm.v$.values.url.$touch()
|
|
|
|
expect(wrapper.vm.v$.values.url.required.$invalid).toBe(true)
|
|
})
|
|
|
|
test('WebhookForm displays an error on too long URL', async () => {
|
|
const wrapper = await mountWebhookForm()
|
|
await changeURL(wrapper, 'http://google.de/' + 'a'.repeat(2001 - 16))
|
|
wrapper.vm.v$.values.url.$touch()
|
|
expect(wrapper.vm.v$.values.url.maxLength.$invalid).toBe(true)
|
|
})
|
|
|
|
test('WebhookForm displays an error on invalid URL', async () => {
|
|
const wrapper = await mountWebhookForm()
|
|
await changeURL(wrapper, 'htt://google.de')
|
|
|
|
wrapper.vm.v$.values.url.$touch()
|
|
expect(wrapper.vm.v$.values.url.isValidURLWithHttpScheme.$invalid).toBe(
|
|
true
|
|
)
|
|
})
|
|
})
|