@uppy/core
Version:
Core module for the extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:
27 lines (22 loc) • 796 B
text/typescript
import { describe, expect, it } from 'vitest'
import Core from './index.js'
import UIPlugin from './UIPlugin.js'
describe('UIPlugin', () => {
describe('getPluginState', () => {
it('returns an empty object if no state is available', () => {
class Example extends UIPlugin<any, any, any> {}
const inst = new Example(new Core<any, any>(), {})
expect(inst.getPluginState()).toEqual({})
})
})
describe('setPluginState', () => {
it('applies patches', () => {
class Example extends UIPlugin<any, any, any> {}
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 })
})
})
})