tests.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. exports.defineAutoTests = function() {
  2. var fail = function (done) {
  3. expect(true).toBe(false);
  4. done();
  5. },
  6. succeed = function (done) {
  7. expect(true).toBe(true);
  8. done();
  9. };
  10. describe('Plugin availability', function () {
  11. it("window.plugins.calendar should exist", function() {
  12. expect(window.plugins.calendar).toBeDefined();
  13. });
  14. });
  15. describe('API functions', function () {
  16. it("should define createEventWithOptions", function() {
  17. expect(window.plugins.calendar.createEventWithOptions).toBeDefined();
  18. });
  19. });
  20. /*
  21. TODO extend - this is a copy-paste example of Toast
  22. describe('Invalid usage', function () {
  23. it("should fail due to an invalid position", function(done) {
  24. window.plugins.toast.show('hi', 'short', 'nowhere', fail.bind(null, done), succeed.bind(null, done));
  25. });
  26. it("should fail due to an invalid duration", function(done) {
  27. window.plugins.toast.show('hi', 'medium', 'top', fail.bind(null, done), succeed.bind(null, done));
  28. });
  29. });
  30. */
  31. };