@@ -801,6 +801,61 @@ describe("createCsvOrder", function () {
801801 } ) ;
802802} ) ;
803803
804+ describe ( "getCsvOrder" , function ( ) {
805+ let csvOrderId : string = null as unknown as string ;
806+ const mapping : CreateCsvOrder [ "mapping" ] = {
807+ recipient : {
808+ city : "{{City}}" ,
809+ name : "{{FirstName}} {{LastName}}" ,
810+ address : "{{Street}} {{HouseNr}}" ,
811+ country : "{{Country}}" ,
812+ postalCode : "{{ZIP}}" ,
813+ } ,
814+ } ;
815+
816+ beforeAll ( async ( ) => {
817+ const file = fs . readFileSync ( path . join ( __dirname , "assets/test.csv" ) ) ;
818+
819+ const csvOrder = await client . createCsvOrder ( {
820+ mapping : mapping ,
821+ template : template ,
822+ finish : Finish . GLOSSY ,
823+ file : file ,
824+ } ) ;
825+
826+ csvOrderId = csvOrder . id ;
827+ } ) ;
828+
829+ it ( "should get a csv order with all fields" , async function ( ) {
830+ // arrange
831+
832+ // act
833+ const csvOrder = await client . getCsvOrder ( csvOrderId ) ;
834+
835+ // assert
836+ expect ( csvOrder ) . toBeDefined ( ) ;
837+ expect ( csvOrder . id ) . toEqual ( expect . any ( String ) ) ;
838+ expect ( csvOrder . status ) . toEqual ( expect . any ( String ) ) ;
839+ expect ( csvOrder . createdAt ) . toEqual ( expect . any ( Date ) ) ;
840+ expect ( csvOrder . updatedAt ) . toEqual ( expect . any ( Date ) ) ;
841+ // if sendDate is undefined, it should be today
842+ expect ( csvOrder . sendDate . getDay ( ) ) . toEqual ( new Date ( ) . getDay ( ) ) ;
843+ expect ( csvOrder . friendlyStatus ) . toEqual ( expect . any ( String ) ) ;
844+ expect ( csvOrder . sender ) . toEqual ( undefined ) ;
845+ expect ( csvOrder . recipientMapping ) . toEqual ( mapping . recipient ) ;
846+ expect ( csvOrder . templateId ) . toEqual ( template . id ) ;
847+ expect ( csvOrder . mergeVariableMapping ) . toEqual ( mapping . mergeVariables ) ;
848+ expect ( csvOrder . billingId ) . toEqual ( undefined ) ;
849+ expect ( csvOrder . finish ) . toEqual ( expect . any ( String ) ) ;
850+ expect ( csvOrder . format ) . toEqual ( expect . any ( String ) ) ;
851+ expect ( csvOrder . isBillable ) . toEqual ( expect . any ( Boolean ) ) ;
852+ expect ( csvOrder . estimatedOrderCount ) . toEqual ( expect . any ( Number ) ) ;
853+ expect ( csvOrder . failedOrderCount ) . toEqual ( expect . any ( Number ) ) ;
854+ expect ( csvOrder . processedOrderCount ) . toEqual ( expect . any ( Number ) ) ;
855+ expect ( csvOrder . totalOrderCount ) . toEqual ( expect . any ( Number ) ) ;
856+ } ) ;
857+ } )
858+
804859describe ( "getOrder" , function ( ) {
805860 let orderId : string = null as unknown as string ;
806861
0 commit comments