@@ -248,30 +248,34 @@ suite('writeIndividualResultFiles()', () => {
248248 results : [ { libraryName : 'MyLib' , expressions : [ { name : 'IPP' , value : '[]' } ] } ] ,
249249 logs : [ ] ,
250250 versions : {
251+ extension : '0.9.7' ,
251252 translator : '4.9.0' ,
252253 engine : '4.9.0' ,
253- clinicalReasoning : '4.7 .0' ,
254- languageServer : '4.8 .0' ,
254+ clinicalReasoning : '4.8 .0' ,
255+ languageServer : '4.9 .0' ,
255256 } ,
256257 } ;
257258 writeIndividualResultFiles ( 'MyLib' , undefined , [ { name : 'p1' } ] , response , Uri . file ( tmpDir ) , Date . now ( ) ) ;
258259 const result = readResult ( 'MyLib' , 'p1' ) ;
259260 expect ( result . versions ) . to . deep . equal ( {
261+ extension : '0.9.7' ,
260262 translator : '4.9.0' ,
261263 engine : '4.9.0' ,
262- clinicalReasoning : '4.7 .0' ,
263- languageServer : '4.8 .0' ,
264+ clinicalReasoning : '4.8 .0' ,
265+ languageServer : '4.9 .0' ,
264266 } ) ;
265267 } ) ;
266268
267- test ( 'omits versions from JSON output when not present in response' , ( ) => {
269+ test ( 'omits dependency version info from JSON output when not present in response' , ( ) => {
268270 const response : ExecuteCqlResponse = {
269271 results : [ { libraryName : 'MyLib' , expressions : [ { name : 'IPP' , value : '[]' } ] } ] ,
270272 logs : [ ] ,
271273 } ;
272274 writeIndividualResultFiles ( 'MyLib' , undefined , [ { name : 'p1' } ] , response , Uri . file ( tmpDir ) , Date . now ( ) ) ;
273275 const result = readResult ( 'MyLib' , 'p1' ) ;
274- expect ( result . versions ) . to . be . undefined ;
276+ expect ( result . versions ) . to . be . deep . equal ( {
277+ extension : '0.9.7' ,
278+ } ) ;
275279 } ) ;
276280
277281 test ( 'overwrites existing file on re-run' , ( ) => {
@@ -291,4 +295,22 @@ suite('writeIndividualResultFiles()', () => {
291295 const result = readResult ( 'MyLib' , 'p1' ) ;
292296 expect ( result . results [ 0 ] . value ) . to . equal ( '[]' ) ;
293297 } ) ;
298+
299+ // Regression: a hyphenated library name (e.g. SUR716-011Assertion) must not
300+ // be truncated at the first hyphen. The output directory and the libraryName
301+ // field in the JSON must use the full name.
302+ test ( 'writes result files under full hyphenated library name, not truncated at first hyphen' , ( ) => {
303+ const libraryName = 'SUR716-011Assertion' ;
304+ const response : ExecuteCqlResponse = {
305+ results : [ { libraryName, expressions : [ { name : 'IPP' , value : '[]' } ] } ] ,
306+ logs : [ ] ,
307+ } ;
308+
309+ writeIndividualResultFiles ( libraryName , undefined , [ { name : 'p1' } ] , response , Uri . file ( tmpDir ) , Date . now ( ) ) ;
310+
311+ expect ( fs . existsSync ( path . join ( tmpDir , 'SUR716-011Assertion' , 'TestCaseResult-p1.json' ) ) ) . to . be . true ;
312+ expect ( fs . existsSync ( path . join ( tmpDir , 'SUR716' , 'TestCaseResult-p1.json' ) ) ) . to . be . false ;
313+ const result = readResult ( 'SUR716-011Assertion' , 'p1' ) ;
314+ expect ( result . libraryName ) . to . equal ( 'SUR716-011Assertion' ) ;
315+ } ) ;
294316} ) ;
0 commit comments