forked from Ivasoft/mattermost-mobile
* Update dependencies including Fastlane and disable Flipper on iOS * Remove EventEmitter for previous doc-viewer * Fix android crash when setting more channels buttons * Downgrade fuse.js * Upgrade deps to latest * Update Podfile.lock * Downgrade RNN to 6.4.0 * QA Review #2 * Upgrade fuse.js to 6.0.0
46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
import React from 'react';
|
|
import {shallow} from 'enzyme';
|
|
|
|
import FileAttachment from './file_attachment.js';
|
|
import Preferences from '@mm-redux/constants/preferences';
|
|
|
|
jest.mock('react-native-file-viewer', () => ({
|
|
open: jest.fn(),
|
|
}));
|
|
|
|
describe('FileAttachment', () => {
|
|
const baseProps = {
|
|
canDownloadFiles: true,
|
|
file: {
|
|
create_at: 1546893090093,
|
|
delete_at: 0,
|
|
extension: 'png',
|
|
has_preview_image: true,
|
|
height: 171,
|
|
id: 'fileId',
|
|
name: 'image.png',
|
|
post_id: 'postId',
|
|
size: 14894,
|
|
update_at: 1546893090093,
|
|
user_id: 'userId',
|
|
width: 425,
|
|
data: {
|
|
mime_type: 'image/png',
|
|
},
|
|
},
|
|
id: 'id',
|
|
index: 0,
|
|
theme: Preferences.THEMES.default,
|
|
};
|
|
|
|
test('should match snapshot', () => {
|
|
const wrapper = shallow(
|
|
<FileAttachment {...baseProps}/>,
|
|
);
|
|
|
|
expect(wrapper.getElement()).toMatchSnapshot();
|
|
});
|
|
});
|