import { IXmlElement } from "../../../src/Common/FileIO/Xml" ; import { TestUtils } from "../../Util/TestUtils" ; import { MXLHelper } from "../../../src/Common/FileIO/Mxl" ; describe ( "MXL Tests" , ( ) => { function testFile ( scoreName ) { it ( `reads ${ scoreName }` , ( done ) => { const mxl = TestUtils . getMXL ( scoreName ) ; chai . expect ( mxl ) . to . not . be . undefined ; MXLHelper . MXLtoIXmlElement ( mxl ) . then ( ( score ) => { chai . expect ( score ) . to . not . be . undefined ; chai . expect ( score . name ) . to . equal ( "score-partwise" ) ; done ( ) ; } , ( exc ) => { throw exc ; } ) . then ( undefined , done ) ; } ) ; } const scores = [ "Mozart_Clarinet_Quintet_Excerpt.mxl" , ] ; for ( const score of scores ) { testFile ( score ) ; } it ( "Corrupted file" , ( done ) => { MXLHelper . MXLtoIXmlElement ( "" ) . then ( ( score ) => { chai . expect ( score ) . to . not . be . undefined ; chai . expect ( score . name ) . to . equal ( "score-partwise" ) ; done ( new Error ( "Empty zip file was loaded correctly. How is that even possible?" ) ) ; } , ( exc ) => { done ( ) ; } ) ; } ) ; } ) ;