tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_BackupService_schema_versions.js (1173B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 https://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 const { ArchiveUtils } = ChromeUtils.importESModule(
      7  "resource:///modules/backup/ArchiveUtils.sys.mjs"
      8 );
      9 
     10 /**
     11 * Tests that there is a BackupManifest schema and a ArchiveJSONBlock schema
     12 * for each schema version from version 1 to ArchiveUtils.SCHEMA_VERSION. This
     13 * test assumes that subsequent schemas versions are only going to increase one
     14 * version at a time, which seems like a reasonable assumption.
     15 */
     16 
     17 add_task(async function test_schemas_exist() {
     18  for (let version = 1; version <= ArchiveUtils.SCHEMA_VERSION; ++version) {
     19    let manifestSchema = await BackupService.getSchemaForVersion(
     20      BackupService.SCHEMAS.BACKUP_MANIFEST,
     21      version
     22    );
     23    Assert.ok(
     24      manifestSchema,
     25      `The BackupManifest schema exists for version ${version}`
     26    );
     27    let archiveJSONBlockSchema = await BackupService.getSchemaForVersion(
     28      BackupService.SCHEMAS.ARCHIVE_JSON_BLOCK,
     29      version
     30    );
     31    Assert.ok(
     32      archiveJSONBlockSchema,
     33      `The ArchiveJSONBlock schema exists for version ${version}`
     34    );
     35  }
     36 });