core.spec.js 928 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. // @todo: TypeError: uppy.then is not a function:
  25. // t.equal(uppy.then(result => result), [1, 2, 3])
  26. // @todo: But this is not acceptable either:
  27. // setTimeout(function () {
  28. // t.equal(uppy, [1, 2, 3])
  29. // }, 4000)
  30. t.end()
  31. })