test(ai): integration coverage for text-effect + mixed-sibling-padding

Why: 3abdfcf9 added integration tests for 4 of the 6 new aesthetic
detectors (rotation / text-cornerRadius / text-stroke / mixed-sibling-
cornerRadius). text-effect (7aef1b14) and mixed-sibling-padding
(ad025c95) landed without integration coverage of the
detect → applyFixes → store mutation chain.

What: 2 more it() cases mirroring the existing pattern:
- text-effect: text node with shadow effects → effects cleared
- mixed-sibling-padding: 3 cards with padding 16/16/20 → outlier
  rewritten to scalar 16 (collapsed from the 4-tuple modal because
  all sides are equal — locks in the scalar-collapse code path)

13 / 13 tests in design-pre-validation.test.ts pass (was 11; +2).
1088 / 1088 AI tests overall (was 1086; +2).
This commit is contained in:
Fini 2026-05-09 21:32:00 +08:00
parent 3bd52767f2
commit 207cc1cd52

View file

@ -363,4 +363,51 @@ describe('design-pre-validation (baseline)', () => {
};
expect(c3?.cornerRadius).toBe(8);
});
it('text-effect: clears effects array on a text node', () => {
loadDocument(
makeDoc([
{
id: 'parent',
type: 'frame',
children: [
{
id: 'shadowed-text',
type: 'text',
content: 'hi',
fontSize: 14,
effects: [{ type: 'shadow', color: '#000', offsetX: 0, offsetY: 4, radius: 8 }],
} as unknown as PenNode,
],
} as unknown as PenNode,
]),
);
expect(runPreValidationFixes()).toBeGreaterThanOrEqual(1);
const text = useDocumentStore.getState().getNodeById('shadowed-text') as PenNode & {
effects?: unknown;
};
expect(text?.effects).toBeUndefined();
});
it('mixed-sibling-padding: rewrites the padding outlier to the modal value', () => {
loadDocument(
makeDoc([
{
id: 'parent',
type: 'frame',
children: [
{ id: 'c1', type: 'frame', role: 'card', padding: 16, children: [] },
{ id: 'c2', type: 'frame', role: 'card', padding: 16, children: [] },
{ id: 'c3', type: 'frame', role: 'card', padding: 20, children: [] },
],
} as unknown as PenNode,
]),
);
expect(runPreValidationFixes()).toBeGreaterThanOrEqual(1);
const c3 = useDocumentStore.getState().getNodeById('c3') as PenNode & {
padding?: unknown;
};
// Modal collapsed back to scalar 16 (all 4 sides equal)
expect(c3?.padding).toBe(16);
});
});