summaryrefslogtreecommitdiffstats
path: root/browser/components/tests/unit/test_browserGlue_migration_no_errors.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /browser/components/tests/unit/test_browserGlue_migration_no_errors.js
parentInitial commit. (diff)
downloadthunderbird-upstream.tar.xz
thunderbird-upstream.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/tests/unit/test_browserGlue_migration_no_errors.js')
-rw-r--r--browser/components/tests/unit/test_browserGlue_migration_no_errors.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/browser/components/tests/unit/test_browserGlue_migration_no_errors.js b/browser/components/tests/unit/test_browserGlue_migration_no_errors.js
new file mode 100644
index 0000000000..aed88c95fe
--- /dev/null
+++ b/browser/components/tests/unit/test_browserGlue_migration_no_errors.js
@@ -0,0 +1,34 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/**
+ * Since various migrations in BrowserGlue are sometimes trivial, e.g. just
+ * clearing a pref, it does not feel necessary to write tests for each of those.
+ *
+ * However, ensuring we have at least some coverage to check for errors, e.g.
+ * typos, is a good idea, hence this test.
+ *
+ * If your migration is more complex that clearing a couple of prefs, you
+ * should consider adding your own BrowserGlue migration test.
+ */
+const TOPIC_BROWSERGLUE_TEST = "browser-glue-test";
+const TOPICDATA_BROWSERGLUE_TEST = "force-ui-migration";
+
+const gBrowserGlue = Cc["@mozilla.org/browser/browserglue;1"].getService(
+ Ci.nsIObserver
+);
+
+// Set the migration value to 1, to ensure that the migration code is called,
+// and so that this doesn't need updating every time we obsolete old tests.
+Services.prefs.setIntPref("browser.migration.version", 1);
+
+add_task(async function test_no_errors() {
+ // Simulate a migration.
+ gBrowserGlue.observe(
+ null,
+ TOPIC_BROWSERGLUE_TEST,
+ TOPICDATA_BROWSERGLUE_TEST
+ );
+
+ Assert.ok(true, "should have run the migration with no errors");
+});