summaryrefslogtreecommitdiffstats
path: root/toolkit/components/places/tests/migration/test_current_from_v53.js
blob: f872dea5d5cad635968599b3abf9a8a2f23e81f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
add_task(async function setup() {
  // Since this migration doesn't affect places.sqlite, we can reuse v43.
  await setupPlacesDatabase("places_v43.sqlite");
  await setupPlacesDatabase("favicons_v41.sqlite", "favicons.sqlite");
});

add_task(async function database_is_valid() {
  // Accessing the database for the first time triggers migration.
  Assert.equal(
    PlacesUtils.history.databaseStatus,
    PlacesUtils.history.DATABASE_STATUS_UPGRADED
  );

  let db = await PlacesUtils.promiseDBConnection();
  Assert.equal(await db.getSchemaVersion(), CURRENT_SCHEMA_VERSION);

  let count = (
    await db.execute(
      `SELECT count(*) FROM moz_icons_to_pages WHERE expire_ms = 0`
    )
  )[0].getResultByIndex(0);
  Assert.equal(count, 0, "All the expirations should be set");
});