Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit def7439

Browse files
author
Kerry Archibald
committed
fix exporter tests
Signed-off-by: Kerry Archibald <[email protected]>
1 parent 77078df commit def7439

File tree

1 file changed

+22
-25
lines changed

1 file changed

+22
-25
lines changed

test/utils/export-test.tsx

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,6 @@ describe('export', function() {
5050
attachmentsIncluded: false,
5151
};
5252

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-
7153
function createRoom() {
7254
const room = new Room(generateRoomId(), null, client.getUserId());
7355
return room;
@@ -212,13 +194,28 @@ describe('export', function() {
212194
).toBeTruthy();
213195
});
214196

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");
222219
});
223220

224221
it('tests the file extension splitter', function() {

0 commit comments

Comments
 (0)