@@ -89,7 +89,8 @@ describe('EmailApi', function () {
8989 startDate . setMilliseconds ( 0 ) ;
9090 const calendarFile = await createCalendar ( startDate ) ;
9191 const calendar = await api . getCalendar ( new requests . GetCalendarRequest ( calendarFile , folder , storage ) ) ;
92- const startDateProperty = calendar . body . internalProperties . find ( item => item . name == 'STARTDATE' ) as models . PrimitiveObject ;
92+ const startDateProperty = calendar . body . internalProperties . find (
93+ item => item . name == 'STARTDATE' ) as models . PrimitiveObject ;
9394 const factStartDate = new Date ( startDateProperty . value ) ;
9495 expect ( factStartDate . getTime ( ) ) . to . equal ( startDate . getTime ( ) ) ;
9596 } ) ;
@@ -277,7 +278,8 @@ describe('EmailApi', function () {
277278 new models . PrimitiveObject ( "Tag:'PidTagBody':0x1000:String" ) ,
278279 new models . PrimitiveObject ( "Tag:'PidTagStoreSupportMask':0x340D:Integer32" , undefined , "265849" ) ,
279280 new models . PrimitiveObject ( "Tag:'PidTagSurname':0x3A11:String" , undefined , "Surname" ) ,
280- new models . PrimitiveObject ( "Tag:'PidTagOtherTelephoneNumber':0x3A1F:String" , undefined , "+79123456789" ) ,
281+ new models . PrimitiveObject ( "Tag:'PidTagOtherTelephoneNumber':0x3A1F:String" , undefined ,
282+ "+79123456789" ) ,
281283 new models . PrimitiveObject ( "Tag:'':0x6662:Integer32" , undefined , "0" ) ,
282284 new models . PrimitiveObject (
283285 "Lid:'PidLidAddressBookProviderArrayType':0x8029:Integer32:00062004-0000-0000-c000-000000000046" ,
@@ -372,6 +374,33 @@ describe('EmailApi', function () {
372374 . to . be . equal ( multiAccount . sendAccount . credentials . discriminator ) ;
373375 } ) ;
374376
377+ it ( 'Check calendar converter #pipeline' , async function ( ) {
378+ const location = 'Some location' ;
379+ //Create DTO with specified location:
380+ let calendarDto = new models . CalendarDto ( ) ;
381+ calendarDto . location = 'Some location' ;
382+ calendarDto . summary = 'Some summary' ;
383+ calendarDto . description = 'some description' ;
384+ calendarDto . startDate = getDate ( undefined , 1 ) ;
385+ calendarDto . endDate = getDate ( calendarDto . startDate , 1 ) ;
386+ calendarDto . organizer = new models . MailAddress ( 'undefined' , 'organizer@aspose.com' ) ;
387+ calendarDto . attendees = [ new models . MailAddress ( 'undefined' , "attendee@aspose.com" ) ] ;
388+ //We can convert this DTO to a MAPI or ICS file:
389+ let mapi = await api . convertCalendarModelToFile ( new requests . ConvertCalendarModelToFileRequest (
390+ 'Msg' , calendarDto ) ) ;
391+ //File content is available at mapi.body as a Buffer object
392+ //Let's convert this buffer to an ICS file:
393+ let ics = await api . convertCalendar ( new requests . ConvertCalendarRequest (
394+ 'Ics' , mapi . body ) ) ;
395+ //ICS is a text format. We can convert the buffer to a string and check that it
396+ //contains specified location as a substring:
397+ let icsString = ics . body . toString ( ) ;
398+ expect ( icsString ) . to . include ( location ) ;
399+ //We can also convert a file buffer back to a CalendarDto
400+ let dto = await api . getCalendarFileAsModel ( new requests . GetCalendarFileAsModelRequest ( ics . body ) ) ;
401+ expect ( dto . body . location ) . to . be . equal ( location ) ;
402+ } ) ;
403+
375404 async function createCalendar ( startDate ?: Date ) : Promise < string > {
376405 const fileName = uuidv4 ( ) + '.ics' ;
377406 startDate = ( startDate == null ) ? getDate ( undefined , 1 ) : startDate ;
0 commit comments