@@ -122,6 +122,33 @@ namespace Demo {
122122 assert . match ( generated . get ( "Demo.Module.ts" ) ! , / e x p o r t \* f r o m ' \. \/ P e r s o n ' / ) ;
123123} ) ;
124124
125+ test ( "supports default and acronym-normalized property naming" , ( ) => {
126+ const files = [
127+ parseSourceFile (
128+ "report.cs" ,
129+ `
130+ public class ULSReport {}
131+ public class Report {
132+ public string SubCategory { get; set; }
133+ public ULSReport ULS { get; set; }
134+ public string URLValue { get; set; }
135+ }` ,
136+ ) ,
137+ ] ;
138+
139+ const defaultReport = new Map ( generate ( files ) . map ( ( file ) => [ file . name , file . text ] ) ) . get ( "Report.ts" ) ! ;
140+ assert . match ( defaultReport , / s u b C a t e g o r y : s t r i n g ; / ) ;
141+ assert . match ( defaultReport , / u L S : U L S R e p o r t ; / ) ;
142+ assert . match ( defaultReport , / u R L V a l u e : s t r i n g ; / ) ;
143+
144+ const normalizedReport = new Map (
145+ generate ( files , { normalizeAcronyms : true } ) . map ( ( file ) => [ file . name , file . text ] ) ,
146+ ) . get ( "Report.ts" ) ! ;
147+ assert . match ( normalizedReport , / s u b C a t e g o r y : s t r i n g ; / ) ;
148+ assert . match ( normalizedReport , / u l s : U L S R e p o r t ; / ) ;
149+ assert . match ( normalizedReport , / u r l V a l u e : s t r i n g ; / ) ;
150+ } ) ;
151+
125152test ( "supports property readonly attributes without global readonly" , ( ) => {
126153 const person = generate ( [
127154 parseSourceFile (
@@ -225,6 +252,7 @@ test("supports current CLI arguments", () => {
225252 "--readonly-properties" ,
226253 "--quote-style=single" ,
227254 "--no-semicolons" ,
255+ "--normalize-acronyms" ,
228256 ] ) ,
229257 {
230258 configPath : "./config/tssharp.json" ,
@@ -239,6 +267,7 @@ test("supports current CLI arguments", () => {
239267 readonlyProperties : true ,
240268 quoteStyle : "single" ,
241269 semicolons : false ,
270+ normalizeAcronyms : true ,
242271 } ,
243272 ) ;
244273} ) ;
@@ -256,6 +285,7 @@ test("loads typesharp.json and lets CLI override file values", async () => {
256285 exportModule : true ,
257286 dictionaryStyle : "index-signature" ,
258287 readonlyProperties : true ,
288+ normalizeAcronyms : true ,
259289 } ) ,
260290 ) ;
261291
@@ -272,6 +302,7 @@ test("loads typesharp.json and lets CLI override file values", async () => {
272302 readonlyProperties : true ,
273303 quoteStyle : undefined ,
274304 semicolons : undefined ,
305+ normalizeAcronyms : true ,
275306 } ) ;
276307 } finally {
277308 await rm ( temp , { recursive : true , force : true } ) ;
@@ -302,6 +333,7 @@ test("defaults fileFilter to C# source files", async () => {
302333 readonlyProperties : undefined ,
303334 quoteStyle : undefined ,
304335 semicolons : undefined ,
336+ normalizeAcronyms : undefined ,
305337 } ) ;
306338 } finally {
307339 await rm ( temp , { recursive : true , force : true } ) ;
0 commit comments