test-main.js 918 B

123456789101112131415161718192021222324
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. var m = require("main");
  5. var self = require("sdk/self");
  6. exports.testReplace = function(test) {
  7. var input = "Hello World";
  8. var output = m.replaceMom(input);
  9. test.assertEqual(output, "Hello Mom");
  10. var callbacks = { quit: function() {} };
  11. // Make sure it doesn't crash...
  12. m.main({ staticArgs: {} }, callbacks);
  13. };
  14. exports.testID = function(test) {
  15. // The ID is randomly generated during tests, so we cannot compare it against
  16. // anything in particular. Just assert that it is not empty.
  17. test.assert(self.id.length > 0);
  18. test.assertEqual(self.data.url("sample.html"),
  19. "resource://reading-data-example-at-jetpack-dot-mozillalabs-dot-com/reading-data/data/sample.html");
  20. };