WIP: sending method as an explicit choice, kept in payload-kv (superseded: the choice moves to a stored field)

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-26 22:30:03 +01:00
co-authored by Claude Fable 5.2
parent 68a2555277
commit c6841a1674
34 changed files with 740 additions and 96 deletions
+18 -1
View File
@@ -699,7 +699,7 @@ describe('iapl-doctor: first-seen dates', () => {
})
describe('e-mail: transport, the mail service, Graph, the confirm route', () => {
const ids = ['mail-transport', 'mail-non-public', 'mail-relay-state', 'mail-reply-address', 'mail-graph-deprecated', 'mail-relay-route']
const ids = ['mail-transport', 'mail-method', 'mail-non-public', 'mail-relay-state', 'mail-reply-address', 'mail-graph-deprecated', 'mail-relay-route']
const relay = (extra: object = {}) => ({ connected: true, disconnected: false, nameReplaced: false, state: 'active', ...extra })
const mail = (extra: object = {}) => ({ graphEnv: false, relay: relay(), replyAddress: true, status: null, transport: 'relay', ...extra })
const run = async (deep: null | object, files: Record<string, string> = {}) =>
@@ -740,6 +740,23 @@ describe('e-mail: transport, the mail service, Graph, the confirm route', () =>
expect(await run(mail({ nonPublic: true, nonPublicBy: 'noindex', otherHostEntries: true }))).toEqual(['mail-non-public:info'])
})
test('mail-method: a chosen method that cannot be used is an error; nothing chosen yet is information', async () => {
const find = async (deep: object) => (await doctor(project({ ...base(), 'src/payload.config.ts': 'iapl({ forms: {} })' }), ids, { deepStatus: { mail: mail(deep) } })).findings.filter((f) => f.rule === 'mail-method')
const smtp = await find({ methodChosen: true, methodProblem: 'smtp-incomplete', relay: relay({ connected: false, state: undefined }), replyAddress: false, transport: 'smtp' })
expect(smtp.map((f) => f.severity)).toEqual(['error'])
expect(smtp[0].message).toContain('e-mails are not sent')
expect(smtp[0].fix).toContain('server, user name and password')
const graph = await find({ methodChosen: true, methodProblem: 'graph-not-set-up', relay: relay({ connected: false, state: undefined }), replyAddress: false, transport: 'graph' })
expect(graph.map((f) => f.severity)).toEqual(['error'])
expect(graph[0].message).toContain('GRAPH_*')
const open = await find({ methodChosen: false })
expect(open.map((f) => f.severity)).toEqual(['info'])
expect(open[0].message).toContain('the built-in service')
expect(open[0].fix).toContain('save')
expect(await find({ methodChosen: true })).toEqual([])
expect(await find({ methodChosen: false, relay: null, transport: 'none' })).toEqual([]) // that is mail-transport's error
})
test('mail-non-public: says which signal makes the site a non-public copy — the development pattern, or IAPL_NOINDEX', async () => {
const find = async (deep: object) => (await doctor(project({ ...base(), 'src/payload.config.ts': 'iapl({ forms: {} })' }), ids, { deepStatus: { mail: mail(deep) } })).findings
const byHost = await find({ nonPublic: true, nonPublicBy: 'development-host', nonPublicPattern: '*.dev.netscale.pl' })