1- import * as requests from '../src/model/requests/requests' ;
2- import * as models from '../src/model/model' ;
31import 'mocha' ;
42import { expect } from 'chai' ;
53import { suiteBase } from "./suite-base" ;
64import uuidv4 from "uuid/v4" ;
5+ import {
6+ MapiCalendarAsFileRequest ,
7+ MapiCalendarAttendeesDto ,
8+ MapiCalendarDailyRecurrencePatternDto ,
9+ MapiCalendarDto ,
10+ MapiCalendarEventRecurrenceDto ,
11+ MapiCalendarFromFileRequest ,
12+ MapiCalendarGetRequest ,
13+ MapiCalendarSaveRequest ,
14+ MapiElectronicAddressDto ,
15+ MapiRecipientDto ,
16+ StorageFileLocation
17+ } from "../src/model" ;
718
819
9- describe ( 'MAPI calendar tests' , function ( ) {
20+ describe ( 'MAPI calendar tests' , function ( ) {
1021 let td = suiteBase ( this ) ;
1122
1223 it ( 'Convert MAPI model to CalendarDto #pipeline' , async ( ) => {
1324 const mapiCalendarDto = getMapiCalendarDto ( ) ;
14- const calendarDto = await td . api ( ) . convertMapiCalendarModelToCalendarModel (
15- new requests . ConvertMapiCalendarModelToCalendarModelRequest ( mapiCalendarDto ) ) ;
16- expect ( mapiCalendarDto . subject ) . to . be . eq ( calendarDto . body . summary ) ;
17- expect ( mapiCalendarDto . location ) . to . be . eq ( calendarDto . body . location ) ;
25+ const calendarDto = await td . api ( ) . mapi . calendar . asCalendarDto ( mapiCalendarDto ) ;
26+ expect ( mapiCalendarDto . subject ) . to . be . eq ( calendarDto . summary ) ;
27+ expect ( mapiCalendarDto . location ) . to . be . eq ( calendarDto . location ) ;
1828 } ) ;
1929
2030 it ( 'Convert MAPI model to file #pipeline' , async ( ) => {
2131 const mapiCalendarDto = getMapiCalendarDto ( ) ;
22- const icsFile = await td . api ( ) . convertMapiCalendarModelToFile (
23- new requests . ConvertMapiCalendarModelToFileRequest ( 'Ics' , mapiCalendarDto ) ) ;
24- const icsString = icsFile . body . toString ( ) ;
32+ const icsFile = await td . api ( ) . mapi . calendar . asFile ( new MapiCalendarAsFileRequest ( 'Ics' , mapiCalendarDto ) ) ;
33+ const icsString = icsFile . toString ( ) ;
2534 expect ( icsString ) . to . contain ( mapiCalendarDto . location ) ;
26- const mapiCalendarDtoConverted = await td . api ( ) . getCalendarFileAsMapiModel (
27- new requests . GetCalendarFileAsMapiModelRequest ( icsFile . body ) ) ;
28- expect ( mapiCalendarDto . location ) . to . be . eq ( mapiCalendarDtoConverted . body . location ) ;
35+ const mapiCalendarDtoConverted = await td . api ( ) . mapi . calendar . fromFile (
36+ new MapiCalendarFromFileRequest ( icsFile ) ) ;
37+ expect ( mapiCalendarDto . location ) . to . be . eq ( mapiCalendarDtoConverted . location ) ;
2938 } ) ;
3039
3140 it ( 'Mapi calendar storage test #pipeline' , async ( ) => {
3241 const mapiCalendarDto = getMapiCalendarDto ( ) ;
3342 const fileName = uuidv4 ( ) + '.msg' ;
34- await td . api ( ) . saveMapiCalendarModel (
35- new requests . SaveMapiCalendarModelRequest ( fileName , "Msg" ,
36- new models . StorageModelRqOfMapiCalendarDto ( mapiCalendarDto , td . getStorageFolderLocation ( ) ) ) ) ;
37- const mapiCalendarFromStorage = await td . api ( ) . getMapiCalendarModel (
38- new requests . GetMapiCalendarModelRequest ( fileName , td . folder ( ) , td . storage ( ) ) ) ;
39- expect ( mapiCalendarDto . location ) . to . be . eq ( mapiCalendarFromStorage . body . location ) ;
43+ await td . api ( ) . mapi . calendar . save (
44+ new MapiCalendarSaveRequest ( new StorageFileLocation ( td . storage ( ) , td . folder ( ) , fileName ) , mapiCalendarDto ,
45+ 'Msg' ) ) ;
46+ const mapiCalendarFromStorage = await td . api ( ) . mapi . calendar . get (
47+ new MapiCalendarGetRequest ( fileName , td . folder ( ) , td . storage ( ) ) ) ;
48+ expect ( mapiCalendarDto . location ) . to . be . eq ( mapiCalendarFromStorage . location ) ;
4049 } ) ;
4150
42- function getMapiCalendarDto ( ) : models . MapiCalendarDto {
43- const mapiCalendarDto = new models . MapiCalendarDto ( ) ;
44- const mapiRecipientDto = new models . MapiRecipientDto ( ) ;
51+ function getMapiCalendarDto ( ) : MapiCalendarDto {
52+ const mapiCalendarDto = new MapiCalendarDto ( ) ;
53+ const mapiRecipientDto = new MapiRecipientDto ( ) ;
4554 mapiRecipientDto . addressType = "SMTP" ;
4655 mapiRecipientDto . displayName = "Attendee Name" ;
4756 mapiRecipientDto . emailAddress = "attendee@aspose.com" ;
4857 mapiRecipientDto . recipientType = "MapiTo" ;
49- mapiCalendarDto . attendees = new models . MapiCalendarAttendeesDto ( [ mapiRecipientDto ] ) ;
58+ mapiCalendarDto . attendees = new MapiCalendarAttendeesDto ( [ mapiRecipientDto ] ) ;
5059 mapiCalendarDto . clientIntent = [ "Manager" ] ;
51- const recurrence = new models . MapiCalendarEventRecurrenceDto ( ) ;
52- const recurrencePatternDto = new models . MapiCalendarDailyRecurrencePatternDto ( ) ;
60+ const recurrence = new MapiCalendarEventRecurrenceDto ( ) ;
61+ const recurrencePatternDto = new MapiCalendarDailyRecurrencePatternDto ( ) ;
5362 recurrencePatternDto . occurrenceCount = 10 ;
5463 recurrencePatternDto . weekStartDay = "Monday" ;
5564 recurrence . recurrencePattern = recurrencePatternDto ;
5665 mapiCalendarDto . recurrence = recurrence ;
57- mapiCalendarDto . organizer = new models . MapiElectronicAddressDto ( undefined , "organizer@aspose.com" ) ;
66+ mapiCalendarDto . organizer = new MapiElectronicAddressDto ( undefined , "organizer@aspose.com" ) ;
5867 mapiCalendarDto . busyStatus = "Tentative" ;
5968 mapiCalendarDto . startDate = td . getDate ( undefined , 1 ) ;
6069 mapiCalendarDto . endDate = td . getDate ( mapiCalendarDto . startDate , 1 ) ;
@@ -64,4 +73,5 @@ describe('MAPI calendar tests', function() {
6473 mapiCalendarDto . subject = "Some summary" ;
6574 return mapiCalendarDto ;
6675 }
67- } ) ;
76+ } )
77+ ;
0 commit comments