browser_activity_stream_strings.js 800 B

123456789101112131415161718
  1. XPCOMUtils.defineLazyServiceGetter(this, "aboutNewTabService",
  2. "@mozilla.org/browser/aboutnewtab-service;1",
  3. "nsIAboutNewTabService");
  4. const LOCALE_PATH = "resource://activity-stream/prerendered/";
  5. /**
  6. * Test current locale strings can be fetched the way activity stream does it.
  7. */
  8. add_task(async function test_activity_stream_fetch_strings() {
  9. const file = `${LOCALE_PATH}${aboutNewTabService.activityStreamLocale}/activity-stream-strings.js`;
  10. const strings = JSON.parse((await (await fetch(file)).text()).match(/{[^]*}/)[0]); // eslint-disable-line fetch-options/no-fetch-credentials
  11. const ids = Object.keys(strings);
  12. info(`Got string ids: ${ids}`);
  13. Assert.ok(ids.length, "Localized strings are available");
  14. });