|
| 1 | +import { fireEvent, waitFor } from '@testing-library/react'; |
1 | 2 | import React from 'react';
|
2 |
| -import { mount } from '../../../tests/reactUtils'; |
3 |
| -import { UploadAttachment } from '../Plugin'; |
| 3 | + |
4 | 4 | import { clearIdStore } from '../../../hooks/useId';
|
5 |
| -import { LoadingContext } from '../../Core/Contexts'; |
6 |
| -import { f } from '../../../utils/functools'; |
7 |
| -import { fireEvent, waitFor } from '@testing-library/react'; |
8 |
| -import { overrideAttachmentSettings } from '../attachments'; |
9 |
| -import attachmentSettings from '../../../tests/ajax/static/context/attachment_settings.json'; |
10 | 5 | import { overrideAjax } from '../../../tests/ajax';
|
11 |
| -import * as Attachments from '../attachments'; |
| 6 | +import attachmentSettings from '../../../tests/ajax/static/context/attachment_settings.json'; |
12 | 7 | import { requireContext } from '../../../tests/helpers';
|
13 |
| -import { deserializeResource } from '../../DataModel/serializers'; |
14 |
| -import { testAttachment } from './utils'; |
| 8 | +import { mount } from '../../../tests/reactUtils'; |
| 9 | +import { f } from '../../../utils/functools'; |
| 10 | +import { LoadingContext } from '../../Core/Contexts'; |
15 | 11 | import { SpecifyResource } from '../../DataModel/legacyTypes';
|
| 12 | +import { deserializeResource } from '../../DataModel/serializers'; |
16 | 13 | import { Attachment } from '../../DataModel/types';
|
| 14 | +import { overrideAttachmentSettings } from '../attachments'; |
| 15 | +import * as Attachments from '../attachments'; |
| 16 | +import { UploadAttachment } from '../Plugin'; |
| 17 | +import { testAttachment } from './utils'; |
17 | 18 |
|
18 | 19 | requireContext();
|
19 | 20 |
|
20 | 21 | async function uploadFileMock() {
|
21 |
| - return deserializeResource(testAttachment) as SpecifyResource<Attachment>; |
| 22 | + return deserializeResource(testAttachment) ; |
22 | 23 | }
|
23 | 24 |
|
24 | 25 | beforeEach(() => {
|
@@ -57,7 +58,7 @@ describe('UploadAttachment', () => {
|
57 | 58 | fireEvent.change(input, { target: { files: [testFile] } });
|
58 | 59 |
|
59 | 60 | await waitFor(() => {
|
60 |
| - expect(handleUploaded).toBeCalled(); |
| 61 | + expect(handleUploaded).toHaveBeenCalled(); |
61 | 62 | });
|
62 | 63 | });
|
63 | 64 | });
|
0 commit comments