@@ -24,6 +24,47 @@ describe('EmailApi', function() {
2424 expect ( primitive . value ) . toBeDefined ( ) ;
2525 } ) ;
2626
27+ it ( 'FileTest' , async function ( ) {
28+ var calendarFile = await createCalendar ( ) ;
29+ var path = folder + '/' + calendarFile ;
30+ var downloaded = await api . downloadFile ( new requests . DownloadFileRequest ( path , storage ) ) ;
31+ var calendarRaw = downloaded . body . toString ( )
32+ expect ( calendarRaw ) . toContain ( 'Organizer' )
33+ await api . uploadFile ( new requests . UploadFileRequest ( path , downloaded . body , storage ) ) ;
34+ var exist = await api . objectExists ( new requests . ObjectExistsRequest ( path , storage ) ) ;
35+ expect ( exist . body . exists ) . toBeTrue ( ) ;
36+ var calendar = await api . getCalendar ( new requests . GetCalendarRequest ( calendarFile , folder , storage ) ) ;
37+ var location = calendar . body . internalProperties
38+ . find ( item => item . type == 'PrimitiveObject' && item . name == 'LOCATION' ) as models . PrimitiveObject ;
39+ expect ( location . value ) . toEqual ( 'location' ) ;
40+ } ) ;
41+
42+ it ( 'Contact format' , async function ( ) {
43+ for ( var format of [ 'VCard' , 'Msg' ] ) {
44+ var extension = ( format == 'Msg' ) ? '.msg' : '.vcf' ;
45+ var fileName = uuidv4 ( ) + extension ;
46+ await api . createContact ( new requests . CreateContactRequest (
47+ format as 'VCard' | 'Msg' ,
48+ fileName ,
49+ new models . HierarchicalObjectRequest (
50+ new models . HierarchicalObject ( 'CONTACT' , undefined , [ ] ) ,
51+ new models . StorageFolderLocation ( storage , folder )
52+ ) ) ) ;
53+ var exists = await api . objectExists ( new requests . ObjectExistsRequest ( folder + '/' + fileName , storage ) ) ;
54+ expect ( exists . body . exists ) . toBeTrue ( ) ;
55+ }
56+ } ) ;
57+
58+ it ( 'Date and time' , async function ( ) {
59+ var startDate = getDate ( undefined , 24 ) ;
60+ startDate . setMilliseconds ( 0 ) ;
61+ var calendarFile = await createCalendar ( startDate ) ;
62+ var calendar = await api . getCalendar ( new requests . GetCalendarRequest ( calendarFile , folder , storage ) ) ;
63+ var startDateProperty = calendar . body . internalProperties . find ( item => item . name == 'STARTDATE' ) as models . PrimitiveObject ;
64+ var factStartDate = new Date ( startDateProperty . value ) ;
65+ expect ( factStartDate ) . toEqual ( startDate ) ;
66+ } ) ;
67+
2768 async function createCalendar ( startDate ? : Date ) :Promise < string > {
2869 var fileName = uuidv4 ( ) + '.ics' ;
2970 startDate = ( startDate == null ) ? getDate ( undefined , 1 ) : startDate ;
0 commit comments