x
This commit is contained in:
1 parent
78b722e120
commit
75770ca122
18 files changed
+1119
-318
No files matched your search
@@ -0,0 +1,46 @@
|
||||
import { describe, expect, test } from 'bun:test'
|
||||
import {
|
||||
DEFAULT_FOOTER_LAYOUT_SETTINGS,
|
||||
FooterLayoutSettingsPatchSchema,
|
||||
FooterLayoutSettingsSchema,
|
||||
} from './index'
|
||||
|
||||
describe('footer layout settings contract', () => {
|
||||
test('keeps the legacy storefront presentation as the default', () => {
|
||||
expect(FooterLayoutSettingsSchema.parse(DEFAULT_FOOTER_LAYOUT_SETTINGS)).toEqual(
|
||||
DEFAULT_FOOTER_LAYOUT_SETTINGS,
|
||||
)
|
||||
})
|
||||
|
||||
test('rejects duplicate and unknown footer columns', () => {
|
||||
const duplicate = FooterLayoutSettingsSchema.safeParse({
|
||||
...DEFAULT_FOOTER_LAYOUT_SETTINGS,
|
||||
columns: ['brand', 'brand'],
|
||||
})
|
||||
const unknown = FooterLayoutSettingsSchema.safeParse({
|
||||
...DEFAULT_FOOTER_LAYOUT_SETTINGS,
|
||||
columns: ['brand', 'legal'],
|
||||
})
|
||||
|
||||
expect(duplicate.success).toBe(false)
|
||||
expect(unknown.success).toBe(false)
|
||||
})
|
||||
|
||||
test('rejects unknown presentation fields', () => {
|
||||
expect(FooterLayoutSettingsSchema.safeParse({
|
||||
...DEFAULT_FOOTER_LAYOUT_SETTINGS,
|
||||
customCss: 'display: none',
|
||||
}).success).toBe(false)
|
||||
})
|
||||
|
||||
test('allows a partial nested finale patch but remains strict', () => {
|
||||
expect(FooterLayoutSettingsPatchSchema.parse({
|
||||
desktopColumns: 3,
|
||||
finale: { enabled: false },
|
||||
})).toEqual({ desktopColumns: 3, finale: { enabled: false } })
|
||||
|
||||
expect(FooterLayoutSettingsPatchSchema.safeParse({
|
||||
finale: { height: '1000vh' },
|
||||
}).success).toBe(false)
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user