Created
November 15, 2019 08:27
-
-
Save pferreir/8a04fb95e72abef5467a232d2e13cf8e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import {shallow} from 'enzyme'; | |
import FileManager, {FileType} from '../components/FileManager'; | |
const data = [ | |
{ | |
id: '1', | |
name: 'Source file', | |
contentTypes: ['text/plain'], | |
multiple: false, | |
files: [{filename: 'file1.txt', url: 'file1url', uuid: 'file1', claimed: true}], | |
}, | |
{ | |
id: '2', | |
name: 'PDF file', | |
contentTypes: ['application/pdf'], | |
multiple: false, | |
files: [{filename: 'file1.pdf', url: 'file1url', uuid: 'file2', claimed: true}], | |
}, | |
{ | |
id: '3', | |
name: 'Image files', | |
contentTypes: ['image/png'], | |
multiple: true, | |
files: [ | |
{filename: 'image.png', url: 'file1url', uuid: 'file3', claimed: true}, | |
{filename: 'image2.png', url: 'file2url', uuid: 'file4', claimed: true}, | |
], | |
}, | |
]; | |
describe('File manager', () => { | |
it('Renders OK', () => { | |
const wrapper = shallow(<FileManager eventId="1" fileTypes={data} />); | |
expect(wrapper.find(FileType)).toHaveLength(3); | |
wrapper.find(FileType).forEach((node, i) => { | |
expect(node.prop('fileType')).toEqual(data[i]); | |
expect(node.prop('uploads')).toEqual({}); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment