summaryrefslogtreecommitdiffstats
path: root/toolkit/components/satchel/test/unit/test_db_update_v5.js
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/satchel/test/unit/test_db_update_v5.js')
-rw-r--r--toolkit/components/satchel/test/unit/test_db_update_v5.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/toolkit/components/satchel/test/unit/test_db_update_v5.js b/toolkit/components/satchel/test/unit/test_db_update_v5.js
new file mode 100644
index 0000000000..f546d4a0f5
--- /dev/null
+++ b/toolkit/components/satchel/test/unit/test_db_update_v5.js
@@ -0,0 +1,29 @@
+/* Any copyright is dedicated to the Public Domain.
+ * https://creativecommons.org/publicdomain/zero/1.0/ */
+
+add_task(async function () {
+ let destPath = await copyToProfile(
+ "formhistory_v3.sqlite",
+ "formhistory.sqlite"
+ );
+ Assert.equal(3, await getDBSchemaVersion(destPath));
+
+ // Do something that will cause FormHistory to access and upgrade the
+ // database
+ await FormHistory.count({});
+
+ // check for upgraded schema.
+ Assert.equal(CURRENT_SCHEMA, await getDBSchemaVersion(destPath));
+
+ // Check that the source tables were added.
+ let db = await Sqlite.openConnection({ path: destPath });
+ try {
+ Assert.ok(db.tableExists("moz_sources"));
+ Assert.ok(db.tableExists("moz_sources_to_history"));
+ } finally {
+ await db.close();
+ }
+ // check that an entry still exists
+ let num = await promiseCountEntries("name-A", "value-A");
+ Assert.ok(num > 0);
+});