@@ -50,24 +50,6 @@ describe('export', function() {
50
50
attachmentsIncluded : false ,
51
51
} ;
52
52
53
- const invalidExportOptions : IExportOptions [ ] = [
54
- {
55
- numberOfMessages : 10 ** 9 ,
56
- maxSize : 1024 * 1024 * 1024 ,
57
- attachmentsIncluded : false ,
58
- } ,
59
- {
60
- numberOfMessages : - 1 ,
61
- maxSize : 4096 * 1024 * 1024 ,
62
- attachmentsIncluded : false ,
63
- } ,
64
- {
65
- numberOfMessages : 0 ,
66
- maxSize : 0 ,
67
- attachmentsIncluded : false ,
68
- } ,
69
- ] ;
70
-
71
53
function createRoom ( ) {
72
54
const room = new Room ( generateRoomId ( ) , null , client . getUserId ( ) ) ;
73
55
return room ;
@@ -212,13 +194,28 @@ describe('export', function() {
212
194
) . toBeTruthy ( ) ;
213
195
} ) ;
214
196
215
- it ( 'checks if the export options are valid' , function ( ) {
216
- for ( const exportOption of invalidExportOptions ) {
217
- expect (
218
- ( ) =>
219
- new PlainTextExporter ( mockRoom , ExportType . Beginning , exportOption , null ) ,
220
- ) . toThrowError ( "Invalid export options" ) ;
221
- }
197
+ const testCases : [ string , IExportOptions ] [ ] = [
198
+ [ 'numberOfMessages exceeds max' , {
199
+ numberOfMessages : 10 ** 9 ,
200
+ maxSize : 1024 * 1024 * 1024 ,
201
+ attachmentsIncluded : false ,
202
+ } ] ,
203
+ [ 'maxSize exceeds 1000GB' , {
204
+ numberOfMessages : - 1 ,
205
+ maxSize : 1024001 * 1024 * 1024 ,
206
+ attachmentsIncluded : false ,
207
+ } ] ,
208
+ [ 'maxSize is less than 1mb' , {
209
+ numberOfMessages : 0 ,
210
+ maxSize : 0 ,
211
+ attachmentsIncluded : false ,
212
+ } ] ,
213
+ ] ;
214
+ it . each ( testCases ) ( '%s' , ( _d , options ) => {
215
+ expect (
216
+ ( ) =>
217
+ new PlainTextExporter ( mockRoom , ExportType . Beginning , options , null ) ,
218
+ ) . toThrowError ( "Invalid export options" ) ;
222
219
} ) ;
223
220
224
221
it ( 'tests the file extension splitter' , function ( ) {
0 commit comments