uppy/packages/@uppy/dashboard/src/index.test.js
Renée Kooi 013eed33f9
Fix setPluginState
I broke this in the object rest spread PR. I noticed the Dashboard was
throwing errors when trying to access `pluginState.target.filter()`.
Added a bunch of tests + fixed that method!
2018-07-19 13:02:23 +02:00

58 lines
1.4 KiB
JavaScript

const Core = require('@uppy/core')
const DashboardPlugin = require('./index')
const StatusBarPlugin = require('@uppy/status-bar')
const GoogleDrivePlugin = require('@uppy/google-drive')
describe('Dashboard', () => {
it('can safely be added together with the StatusBar without id conflicts', () => {
const core = new Core()
core.use(StatusBarPlugin)
expect(() => {
core.use(DashboardPlugin, { inline: false })
}).not.toThrow()
core.close()
})
it('works without any remote provider plugins', () => {
const core = new Core()
expect(() => {
core.use(DashboardPlugin, {
inline: true,
target: 'body'
})
}).not.toThrow()
core.close()
})
it('works when targeting remote provider plugins using `target`', () => {
const core = new Core()
expect(() => {
core.use(DashboardPlugin, {
inline: true,
target: 'body'
})
core.use(GoogleDrivePlugin, { target: DashboardPlugin, serverUrl: 'https://fake.uppy.io/' })
}).not.toThrow()
core.close()
})
it('works when passing plugins in `plugins` array', () => {
const core = new Core()
core.use(GoogleDrivePlugin, { serverUrl: 'https://fake.uppy.io/' })
expect(() => {
core.use(DashboardPlugin, {
inline: true,
target: 'body',
plugins: ['GoogleDrive']
})
}).not.toThrow()
core.close()
})
})