main.js 904 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. 'use strict';
  5. const { Cc, Ci, Cu, Cm, components } = require('chrome');
  6. const self = require('sdk/self');
  7. const { AddonManager } = Cu.import('resource://gre/modules/AddonManager.jsm', {});
  8. exports.testTranslators = function(assert, done) {
  9. AddonManager.getAddonByID(self.id, function(addon) {
  10. let count = 0;
  11. addon.translators.forEach(function({ name }) {
  12. count++;
  13. assert.equal(name, 'Erik Vold', 'The translator keys are correct');
  14. });
  15. assert.equal(count, 1, 'The translator key count is correct');
  16. assert.equal(addon.translators.length, 1, 'The translator key length is correct');
  17. done();
  18. });
  19. }
  20. require('sdk/test/runner').runTestsFromModule(module);