mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 03:36:07 +03:00
Use throw error instead of try-catch
This commit is contained in:
parent
edfc8af6cf
commit
9cbdc4a613
1 changed files with 5 additions and 12 deletions
|
@ -168,22 +168,15 @@ describe('export', function() {
|
|||
expect(textForFormat('HTML')).toBeTruthy();
|
||||
expect(textForFormat('JSON')).toBeTruthy();
|
||||
expect(textForFormat('PLAIN_TEXT')).toBeTruthy();
|
||||
try {
|
||||
textForFormat('PDF');
|
||||
throw new Error("Expected to throw an error");
|
||||
} catch (e) {
|
||||
expect(e.message).toBe("Unknown format");
|
||||
}
|
||||
expect(() => textForFormat('PDF')).toThrowError("Unknown format");
|
||||
});
|
||||
|
||||
it('checks if the export options are valid', function() {
|
||||
for (const exportOption of invalidExportOptions) {
|
||||
try {
|
||||
new PlainTextExporter(mockRoom, ExportType.Beginning, exportOption, null);
|
||||
throw new Error("Expected to throw an error");
|
||||
} catch (e) {
|
||||
expect(e.message).toBe("Invalid export options");
|
||||
}
|
||||
expect(
|
||||
() =>
|
||||
new PlainTextExporter(mockRoom, ExportType.Beginning, exportOption, null),
|
||||
).toThrowError("Invalid export options");
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue