@@ -16,65 +16,19 @@ describe('compact_file', () => {
1616 return { input, expected }
1717 }
1818
19- it ( 'should remove single line comments' , ( ) => {
20- const { input, expected } = load_test_case ( 'remove-single-line-comments' )
21- expect ( compact_file ( input , '.ts' ) ) . toBe ( expected )
22- } )
23-
24- it ( 'should remove block comments on a single line' , ( ) => {
25- const { input, expected } = load_test_case (
26- 'remove-block-comments-single-line'
27- )
28- expect ( compact_file ( input , '.ts' ) ) . toBe ( expected )
29- } )
30-
31- it ( 'should remove multi-line block comments' , ( ) => {
32- const { input, expected } = load_test_case (
33- 'remove-multi-line-block-comments'
34- )
35- expect ( compact_file ( input , '.ts' ) ) . toBe ( expected )
36- } )
37-
38- it ( 'should preserve comments inside double quotes' , ( ) => {
39- const { input, expected } = load_test_case ( 'preserve-double-quotes' )
40- expect ( compact_file ( input , '.ts' ) ) . toBe ( expected )
41- } )
42-
43- it ( 'should preserve comments inside single quotes' , ( ) => {
44- const { input, expected } = load_test_case ( 'preserve-single-quotes' )
45- expect ( compact_file ( input , '.ts' ) ) . toBe ( expected )
46- } )
47-
48- it ( 'should preserve comments inside template literals' , ( ) => {
49- const { input, expected } = load_test_case ( 'preserve-template-literals' )
50- expect ( compact_file ( input , '.ts' ) ) . toBe ( expected )
51- } )
52-
53- it ( 'should preserve block comments inside strings' , ( ) => {
54- const { input, expected } = load_test_case (
55- 'preserve-block-comments-in-strings'
19+ it ( 'should handle c-style content (combined)' , ( ) => {
20+ const case_path = path . join ( __dirname , 'test-cases' , 'c-style' )
21+ const input = fs . readFileSync ( path . join ( case_path , 'input.txt' ) , 'utf-8' )
22+ const expected = fs . readFileSync (
23+ path . join ( case_path , 'output.txt' ) ,
24+ 'utf-8'
5625 )
5726 expect ( compact_file ( input , '.ts' ) ) . toBe ( expected )
5827 } )
5928
60- it ( 'should handle escaped quotes inside strings' , ( ) => {
61- const { input, expected } = load_test_case ( 'handle-escaped-quotes' )
62- expect ( compact_file ( input , '.ts' ) ) . toBe ( expected )
63- } )
64-
65- it ( 'should handle complex mixed content' , ( ) => {
66- const { input, expected } = load_test_case ( 'complex-mixed-content' )
67- expect ( compact_file ( input , '.ts' ) ) . toBe ( expected )
68- } )
69-
70- it ( 'should handle input with only comments' , ( ) => {
71- const { input, expected } = load_test_case ( 'only-comments' )
72- expect ( compact_file ( input , '.ts' ) ) . toBe ( expected )
73- } )
74-
75- it ( 'should strip function bodies when enabled' , ( ) => {
76- const { input, expected } = load_test_case ( 'javascript-bodies' )
77- expect ( compact_file ( input , '.ts' ) ) . toBe ( expected )
29+ it ( 'should strip jsx bodies' , ( ) => {
30+ const { input, expected } = load_test_case ( 'jsx' , '.' )
31+ expect ( compact_file ( input , '.tsx' ) ) . toBe ( expected )
7832 } )
7933
8034 it ( 'should strip python function bodies' , ( ) => {
@@ -96,4 +50,9 @@ describe('compact_file', () => {
9650 const { input, expected } = load_test_case ( 'sql' , '.' )
9751 expect ( compact_file ( input , '.sql' ) ) . toBe ( expected )
9852 } )
53+
54+ it ( 'should strip html comments' , ( ) => {
55+ const { input, expected } = load_test_case ( 'html' , '.' )
56+ expect ( compact_file ( input , '.html' ) ) . toBe ( expected )
57+ } )
9958} )
0 commit comments