Mail relay: state block without an import-map entry, e2e on the reference site, sharper failure reports
- the state block is rendered by IntegrationStatusBanner (no new admin component: generate:importmap gives no diff) - reference site: e2e/mail-relay.spec.ts with a fixture and setup script; e2e:built runs it with both bundlers - a failed enrolment is reported as what it was; the service's own refusal after a fresh enrolment - a message keeps its key after any failure that is not final - a local site is shown as refused in the panel before any e-mail Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
dd3792cbc7
commit
2cceceffd0
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* For e2e/mail-relay.spec.ts — LOCAL / CI database only:
|
||||
* pnpm payload run e2e/mail-relay-setup.ts the site has no SMTP server and no token: its next e-mail
|
||||
* goes to the mail service, enrolling first
|
||||
* Afterwards the spec runs e2e/create-test-admin.ts again, which points e-mail back at the tests' SMTP sink.
|
||||
*/
|
||||
import config from '@payload-config'
|
||||
import { RELAY_KV_KEY } from '@intecion/ipal-kit'
|
||||
import { isLocalDatabase } from '@intecion/ipal-kit/seed'
|
||||
import { getPayload } from 'payload'
|
||||
|
||||
if (process.env.NODE_ENV === 'production' && !process.env.CI) {throw new Error('Refusing: NODE_ENV=production outside CI.')}
|
||||
if (!isLocalDatabase(process.env.DATABASE_URI ?? '')) {throw new Error('Refusing: DATABASE_URI is not a local database.')}
|
||||
|
||||
const payload = await getPayload({ config })
|
||||
await payload.updateGlobal({
|
||||
slug: 'site-integrations',
|
||||
context: { ipalIntegrationStatus: true },
|
||||
data: { emailStatus: { checkedAt: null, code: null, message: null, since: null, state: null }, emailTransport: 'smtp', smtpFromAddress: '[email protected]', smtpFromName: 'Example Studio', smtpHost: null, smtpPassword: null, smtpUser: null } as never,
|
||||
overrideAccess: true,
|
||||
})
|
||||
for (const key of await payload.kv.keys()) {
|
||||
if (key === RELAY_KV_KEY || key.startsWith(`${RELAY_KV_KEY}:`)) {await payload.kv.delete(key)}
|
||||
}
|
||||
console.log('[e2e] no SMTP server and no mail-service token: the next e-mail enrols and goes through the mail service')
|
||||
process.exit(0)
|
||||
Reference in New Issue
Block a user