mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-18 00:55:35 +00:00
47 lines
1.5 KiB
JavaScript
47 lines
1.5 KiB
JavaScript
import test from 'tape'
|
|
import Uppy from '../../src/core/Core.js'
|
|
import Acquirer1Plugin from './mocks/plugin-acquirer1.js'
|
|
// import Acquirer2Plugin from './mocks/plugin-acquirer2.js'
|
|
|
|
test('core', function (t) {
|
|
t.equal(typeof new Uppy(), 'object', '`new Uppy()` should return an `object`')
|
|
t.equal(typeof Uppy(), 'object', '`Uppy()` without `new` should also return an `object`')
|
|
// t.ok(uppy instanceof Uppy, '`uppy` should be an instance of `Core` core')
|
|
t.end()
|
|
})
|
|
|
|
test('use plugins', function (t) {
|
|
const uppy = new Uppy()
|
|
uppy
|
|
.use(Acquirer1Plugin)
|
|
|
|
t.equal(Object.keys(uppy.plugins).length, 1, 'should add a plugin to the plugins stack')
|
|
t.end()
|
|
})
|
|
|
|
test('noDuplicates', function (t) {
|
|
const uppyTwoAcquirers = new Uppy()
|
|
|
|
uppyTwoAcquirers.use(Acquirer1Plugin)
|
|
const fn = uppyTwoAcquirers.use.bind(uppyTwoAcquirers, Acquirer1Plugin)
|
|
|
|
t.throws(fn, new RegExp('Uppy is currently limited to running one of every plugin'))
|
|
t.end()
|
|
})
|
|
|
|
// test('autoProceed', function (t) {
|
|
// const uppyOneAcquirer = new Core()
|
|
// uppyOneAcquirer
|
|
// .use(Acquirer1Plugin)
|
|
// .run()
|
|
//
|
|
// const uppyTwoAcquirers = new Core()
|
|
// uppyTwoAcquirers
|
|
// .use(Acquirer1Plugin)
|
|
// .use(Acquirer2Plugin)
|
|
// .run()
|
|
//
|
|
// t.equal(uppyOneAcquirer.opts.autoProceed, true, 'should autoProceed if only one acquirer is used')
|
|
// t.equal(uppyTwoAcquirers.opts.autoProceed, false, 'should not autoProceed if more than one acquirer is used')
|
|
// t.end()
|
|
// })
|