client-tests.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. function equals(a, b) {
  2. return !!(EJSON.stringify(a) === EJSON.stringify(b));
  3. }
  4. Tinytest.add('cfs-gridfs - client - test environment', function(test) {
  5. test.isTrue(typeof FS.Collection !== 'undefined', 'test environment not initialized FS.Collection');
  6. test.isTrue(typeof CFSErrorType !== 'undefined', 'test environment not initialized CFSErrorType');
  7. });
  8. /*
  9. * FS.File Client Tests
  10. *
  11. * construct FS.File with no arguments
  12. * construct FS.File passing in File
  13. * construct FS.File passing in Blob
  14. * load blob into FS.File and then call FS.File.toDataUrl
  15. * call FS.File.setDataFromBinary, then FS.File.getBlob(); make sure correct data is returned
  16. * load blob into FS.File and then call FS.File.getBinary() with and without start/end; make sure correct data is returned
  17. * construct FS.File, set FS.File.collectionName to a CFS name, and then test FS.File.update/remove/get/put/del/url
  18. * set FS.File.name to a filename and test that FS.File.getExtension() returns the extension
  19. * load blob into FS.File and make sure FS.File.saveLocal initiates a download (possibly can't do automatically)
  20. *
  21. */
  22. //Test API:
  23. //test.isFalse(v, msg)
  24. //test.isTrue(v, msg)
  25. //test.equalactual, expected, message, not
  26. //test.length(obj, len)
  27. //test.include(s, v)
  28. //test.isNaN(v, msg)
  29. //test.isUndefined(v, msg)
  30. //test.isNotNull
  31. //test.isNull
  32. //test.throws(func)
  33. //test.instanceOf(obj, klass)
  34. //test.notEqual(actual, expected, message)
  35. //test.runId()
  36. //test.exception(exception)
  37. //test.expect_fail()
  38. //test.ok(doc)
  39. //test.fail(doc)
  40. //test.equal(a, b, msg)