@@ -35,19 +35,45 @@ describe("composition rules", () => {
3535 expect ( finding ) . toBeUndefined ( ) ;
3636 } ) ;
3737
38- it ( "warns on large HTML files regardless of path " , ( ) => {
38+ it ( "does not warn for large registry source block files " , ( ) => {
3939 const html = Array . from ( { length : 301 } , ( _ , i ) =>
4040 i === 0 ? "<html><body>" : `<!-- filler ${ i } -->` ,
4141 ) . join ( "\n" ) ;
4242
4343 const result = lintHyperframeHtml ( html , {
44- filePath : "/project/registry/blocks/data-chart.html" ,
44+ filePath : "/project/registry/blocks/data-chart/data-chart.html" ,
45+ } ) ;
46+ const finding = result . findings . find ( ( f ) => f . code === "composition_file_too_large" ) ;
47+ expect ( finding ) . toBeUndefined ( ) ;
48+ } ) ;
49+
50+ it ( "warns for large installed block composition files" , ( ) => {
51+ const html = Array . from ( { length : 301 } , ( _ , i ) =>
52+ i === 0 ? "<html><body>" : `<!-- filler ${ i } -->` ,
53+ ) . join ( "\n" ) ;
54+
55+ const result = lintHyperframeHtml ( html , {
56+ filePath : "/project/compositions/data-chart.html" ,
4557 } ) ;
4658 const finding = result . findings . find ( ( f ) => f . code === "composition_file_too_large" ) ;
4759 expect ( finding ) . toBeDefined ( ) ;
4860 expect ( finding ?. severity ) . toBe ( "warning" ) ;
4961 } ) ;
5062
63+ it ( "does not warn for large registry-installed block composition files" , ( ) => {
64+ const html =
65+ "<!-- hyperframes-registry-item: data-chart -->\n" +
66+ Array . from ( { length : 300 } , ( _ , i ) =>
67+ i === 0 ? "<html><body>" : `<!-- filler ${ i } -->` ,
68+ ) . join ( "\n" ) ;
69+
70+ const result = lintHyperframeHtml ( html , {
71+ filePath : "/project/compositions/data-chart.html" ,
72+ } ) ;
73+ const finding = result . findings . find ( ( f ) => f . code === "composition_file_too_large" ) ;
74+ expect ( finding ) . toBeUndefined ( ) ;
75+ } ) ;
76+
5177 it ( "uses nested split copy for large sub-composition files" , ( ) => {
5278 const html = Array . from ( { length : 301 } , ( _ , i ) =>
5379 i === 0 ? "<html><body>" : `<!-- filler ${ i } -->` ,
0 commit comments