|
6 | 6 | OBJECT_REFERENCE_UNKNOWN, |
7 | 7 | OBJECT_REFERENCE_UNREGISTERED_PLATFORM, |
8 | 8 | } from './validate-object-references.js'; |
| 9 | +import { runAuthoringRules, splitBySeverity } from './authoring-rules.js'; |
9 | 10 |
|
10 | 11 | /** Minimal stack with one own object, mirroring the HotCRM shape. */ |
11 | 12 | const baseStack = () => ({ |
@@ -763,3 +764,28 @@ describe('[#20216] validateObjectReferences — view container `object`', () => |
763 | 764 | expect(validateObjectReferences(appStack([unbound]))).toEqual([]); |
764 | 765 | }); |
765 | 766 | }); |
| 767 | + |
| 768 | +/** |
| 769 | + * [#20216] The same finding through the ONE rule table all three commands run |
| 770 | + * (`runAuthoringRules`), at the gating tier — so `os validate`, `os build` and |
| 771 | + * `os lint` exit 1 on it exactly as they do on the sibling relationship-target |
| 772 | + * leg, rather than the rule merely existing. |
| 773 | + */ |
| 774 | +describe('[#20216] a dangling view container `object` gates every CLI command', () => { |
| 775 | + const stack = (object: string) => ({ |
| 776 | + manifest: { id: 'com.example.my_app', namespace: 'my_app' }, |
| 777 | + objects: [{ name: 'my_app_order_line', fields: { name: { type: 'text' } } }], |
| 778 | + views: [{ name: 'order_line', object, list: { type: 'grid', columns: [{ field: 'name' }] } }], |
| 779 | + }); |
| 780 | + const hits = (command: 'validate' | 'build' | 'lint', object: string) => |
| 781 | + splitBySeverity(runAuthoringRules(command, { normalized: stack(object) as never })) |
| 782 | + .errors.filter((f) => f.rule === OBJECT_REFERENCE_UNKNOWN) |
| 783 | + .map((f) => f.path); |
| 784 | + |
| 785 | + for (const command of ['validate', 'build', 'lint'] as const) { |
| 786 | + it(`\`${command}\` refuses the un-prefixed binding and passes the prefixed one`, () => { |
| 787 | + expect(hits(command, 'order_line')).toEqual(['views[0].object']); |
| 788 | + expect(hits(command, 'my_app_order_line')).toEqual([]); |
| 789 | + }); |
| 790 | + } |
| 791 | +}); |
0 commit comments