WP-02: contracts and failing tests for settings, mail, jobs and scheduler
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
33
frontend/src/components/SmtpForm.test.ts
Normal file
33
frontend/src/components/SmtpForm.test.ts
Normal file
@ -0,0 +1,33 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import SmtpForm from './SmtpForm.vue'
|
||||
|
||||
const current = {
|
||||
host: 'mail.example.com',
|
||||
port: 587,
|
||||
security: 'starttls' as const,
|
||||
username: 'bot',
|
||||
from: 'mon@example.com',
|
||||
notify_to: ['ops@example.com', 'dev@example.com'],
|
||||
password_set: true,
|
||||
}
|
||||
|
||||
describe('SmtpForm', () => {
|
||||
it('prefills current settings and emits the payload with recipients as a list', async () => {
|
||||
const w = mount(SmtpForm, { props: { current } })
|
||||
expect((w.find('input[name=host]').element as HTMLInputElement).value).toBe('mail.example.com')
|
||||
expect((w.find('input[name=notify_to]').element as HTMLInputElement).value).toBe(
|
||||
'ops@example.com, dev@example.com',
|
||||
)
|
||||
await w.find('input[name=notify_to]').setValue('a@x.de; b@x.de')
|
||||
await w.find('form').trigger('submit')
|
||||
const payload = w.emitted('submit')![0][0] as Record<string, unknown>
|
||||
expect(payload.notify_to).toEqual(['a@x.de', 'b@x.de'])
|
||||
expect(payload.password).toBe('')
|
||||
expect(payload.port).toBe(587)
|
||||
})
|
||||
|
||||
it('shows a hint that a password is stored', () => {
|
||||
const w = mount(SmtpForm, { props: { current } })
|
||||
expect(w.text()).toContain('leave empty to keep')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user