core.spec.js 826 B

123456789101112131415161718192021222324252627282930313233343536
  1. var test = require('tape')
  2. var Uppy = require('../src/core/index.js')
  3. const TestPlugin = require('./mocks/test-plugin.js')
  4. const uppy = new Uppy({debug: true})
  5. uppy
  6. .use(TestPlugin, {target: '.UppyDragDrop-One'})
  7. .run()
  8. test('core object', function (t) {
  9. const uppy = new Uppy()
  10. t.equal(typeof uppy, 'object', 'new Core() should return an object')
  11. t.end()
  12. })
  13. test('core type', function (t) {
  14. const uppy = new Uppy()
  15. t.equal(uppy.type, 'core', 'core.type should equal core')
  16. t.end()
  17. })
  18. test('run one plugin success', function (t) {
  19. const TestPlugin = require('./mocks/test-plugin.js')
  20. const uppy = new Uppy({debug: true})
  21. uppy
  22. .use(TestPlugin)
  23. .run()
  24. t.equal(uppy.then(result => result), [1, 2, 3])
  25. // setTimeout(function () {
  26. // t.equal(uppy, [1, 2, 3])
  27. // }, 4000)
  28. t.end()
  29. })