|
@@ -350,7 +350,11 @@ describe('filebrowser/model', () => {
|
|
|
expect(contents.name).toBe(fname);
|
|
|
const promise = model.upload(file);
|
|
|
await dismissDialog();
|
|
|
- await expect(promise).rejects.toThrow('File not uploaded');
|
|
|
+ try {
|
|
|
+ await promise;
|
|
|
+ } catch (e) {
|
|
|
+ expect(e).toBe('File not uploaded');
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
it('should emit the fileChanged signal', async () => {
|
|
@@ -383,9 +387,12 @@ describe('filebrowser/model', () => {
|
|
|
it('should not upload large file', async () => {
|
|
|
const fname = UUID.uuid4() + '.html';
|
|
|
const file = new File([new ArrayBuffer(LARGE_FILE_SIZE + 1)], fname);
|
|
|
- await expect(model.upload(file)).rejects.toThrow(
|
|
|
- `Cannot upload file (>15 MB). ${fname}`
|
|
|
- );
|
|
|
+ try {
|
|
|
+ await model.upload(file);
|
|
|
+ throw new Error('Upload should have failed');
|
|
|
+ } catch (err) {
|
|
|
+ expect(err).toBe(`Cannot upload file (>15 MB). ${fname}`);
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
afterAll(() => {
|