-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathFileDownloadCards.test.tsx
More file actions
46 lines (40 loc) · 1.26 KB
/
FileDownloadCards.test.tsx
File metadata and controls
46 lines (40 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import React from 'react';
import { AttachmentMetadata, _FileDownloadCards } from './FileDownloadCards';
import { render, screen } from '@testing-library/react';
import { registerIcons } from '@fluentui/react';
describe('FileDownloadCards should be rendered properly', () => {
beforeEach(() => {
registerIcons({
icons: {
downloadfile: <></>,
docx24_svg: <></>,
editboxcancel: <></>
}
});
});
it('should render if it is FileSharingMetadata', async () => {
const metadata: AttachmentMetadata = {
name: 'MockFileCard',
extension: 'docx',
url: 'mockUrl',
/* @conditional-compile-remove(file-sharing) */
id: 'mockId'
};
const props = {
userId: 'MockUserId',
fileMetadata: [metadata]
};
renderFileDownloadCardsWithDefaults(props);
const card = await screen.findByText('MockFileCard');
expect(card).toBeDefined();
});
});
const renderFileDownloadCardsWithDefaults = (props: MockDownloadCardProps): void => {
render(<_FileDownloadCards userId={props.userId} fileMetadata={props.fileMetadata} />);
};
interface MockDownloadCardProps {
userId: string;
fileMetadata: AttachmentMetadata[];
}