enabled: false keeps the plugin's schema, drops only its behaviour
Returning the incoming config dropped the plugin's collections and globals,
so a Postgres migration would drop their tables. Now collections, globals
and fields stay; endpoints, onInit and admin components are left out.
Also: ipalKit({ forms: { consentFieldName } }) is stored in config.custom.ipal.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
a87742621a
commit
38c1d9215e
+12
-3
@@ -45,9 +45,18 @@ describe('ipalKit — config transform', () => {
|
||||
expect(totp).toHaveBeenCalledWith(expect.objectContaining({ forceSetup: true, totp: { issuer: 'Acme' } }))
|
||||
})
|
||||
|
||||
test('enabled: false leaves the config untouched', async () => {
|
||||
const config = base()
|
||||
expect(await ipalKit({ enabled: false, i18n, twoFactor: false })(config)).toBe(config)
|
||||
test('enabled: false keeps the schema (collections, globals) but adds no endpoints, onInit or admin components', async () => {
|
||||
const config = await ipalKit({ access: { authCollection: 'users' }, consentLog: true, enabled: false, i18n, stats: true, twoFactor: false })(base())
|
||||
expect(config.globals?.map((g) => g.slug)).toEqual(expect.arrayContaining(['site-settings', 'site-integrations', 'cookie-settings', 'notifications']))
|
||||
expect(config.collections?.map((c) => c.slug)).toEqual(expect.arrayContaining(['users', 'consent-records', 'stats-visits']))
|
||||
expect(config.endpoints ?? []).toEqual([])
|
||||
expect(config.onInit).toBeUndefined()
|
||||
expect(config.admin?.components).toBeUndefined()
|
||||
})
|
||||
|
||||
test('forms.consentFieldName reaches submitForm through config.custom.ipal', async () => {
|
||||
const config = await ipalKit({ forms: { consentFieldName: 'zgoda' }, i18n, twoFactor: false })(base())
|
||||
expect((config.custom as { ipal?: { consentFieldName?: string } }).ipal?.consentFieldName).toBe('zgoda')
|
||||
})
|
||||
|
||||
test('invalid i18n fails fast', () => {
|
||||
|
||||
Reference in New Issue
Block a user