mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-22 17:58:05 +00:00
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!
25 lines
704 B
JavaScript
25 lines
704 B
JavaScript
const Plugin = require('./Plugin')
|
|
const Core = require('./index')
|
|
|
|
describe('Plugin', () => {
|
|
describe('getPluginState', () => {
|
|
it('returns an empty object if no state is available', () => {
|
|
class Example extends Plugin {}
|
|
const inst = new Example(new Core(), {})
|
|
|
|
expect(inst.getPluginState()).toEqual({})
|
|
})
|
|
})
|
|
|
|
describe('setPluginState', () => {
|
|
it('applies patches', () => {
|
|
class Example extends Plugin {}
|
|
const inst = new Example(new Core(), {})
|
|
|
|
inst.setPluginState({ a: 1 })
|
|
expect(inst.getPluginState()).toEqual({ a: 1 })
|
|
inst.setPluginState({ b: 2 })
|
|
expect(inst.getPluginState()).toEqual({ a: 1, b: 2 })
|
|
})
|
|
})
|
|
})
|