|
@@ -1,27 +1,27 @@
|
|
|
-var test = require('tape')
|
|
|
-var Uppy = require('../../src/core/Core.js')
|
|
|
+import test from 'tape'
|
|
|
+import Core from '../../src/core/Core.js'
|
|
|
+import Acquirer1Plugin from './mocks/plugin-acquirer1.js'
|
|
|
+import Acquirer2Plugin from './mocks/plugin-acquirer2.js'
|
|
|
|
|
|
test('core', function (t) {
|
|
|
- const uppy = new Uppy()
|
|
|
+ const uppy = new Core()
|
|
|
|
|
|
t.equal(typeof uppy, 'object', '`new Core()` should return an `object`')
|
|
|
- t.ok(uppy instanceof Uppy, '`uppy` should be an instance of `Uppy` core')
|
|
|
+ t.ok(uppy instanceof Core, '`uppy` should be an instance of `Core` core')
|
|
|
t.end()
|
|
|
})
|
|
|
|
|
|
test('use plugins', function (t) {
|
|
|
- const AcquirerPlugin = require('./mocks/plugin-acquirer1.js')
|
|
|
- const uppy = new Uppy()
|
|
|
+ const uppy = new Core()
|
|
|
uppy
|
|
|
- .use(AcquirerPlugin)
|
|
|
+ .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 Acquirer1Plugin = require('./mocks/plugin-acquirer1.js')
|
|
|
- const uppyTwoAcquirers = new Uppy()
|
|
|
+ const uppyTwoAcquirers = new Core()
|
|
|
|
|
|
uppyTwoAcquirers.use(Acquirer1Plugin)
|
|
|
const fn = uppyTwoAcquirers.use.bind(uppyTwoAcquirers, Acquirer1Plugin)
|
|
@@ -31,15 +31,12 @@ test('noDuplicates', function (t) {
|
|
|
})
|
|
|
|
|
|
test('autoProceed', function (t) {
|
|
|
- const Acquirer1Plugin = require('./mocks/plugin-acquirer1.js')
|
|
|
- const Acquirer2Plugin = require('./mocks/plugin-acquirer2.js')
|
|
|
-
|
|
|
- const uppyOneAcquirer = new Uppy()
|
|
|
+ const uppyOneAcquirer = new Core()
|
|
|
uppyOneAcquirer
|
|
|
.use(Acquirer1Plugin)
|
|
|
.run()
|
|
|
|
|
|
- const uppyTwoAcquirers = new Uppy()
|
|
|
+ const uppyTwoAcquirers = new Core()
|
|
|
uppyTwoAcquirers
|
|
|
.use(Acquirer1Plugin)
|
|
|
.use(Acquirer2Plugin)
|