tor-browser

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

test_countToBucketBreakdown_01.js (1026B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 "use strict";
      4 
      5 // Test that we can turn a breakdown with { by: "count" } leaves into a
      6 // breakdown with { by: "bucket" } leaves.
      7 
      8 const COUNT = { by: "count", count: true, bytes: true };
      9 const BUCKET = { by: "bucket" };
     10 
     11 const BREAKDOWN = {
     12  by: "coarseType",
     13  objects: { by: "objectClass", then: COUNT, other: COUNT },
     14  strings: COUNT,
     15  scripts: {
     16    by: "filename",
     17    then: { by: "internalType", then: COUNT },
     18    noFilename: { by: "internalType", then: COUNT },
     19  },
     20  other: { by: "internalType", then: COUNT },
     21 };
     22 
     23 const EXPECTED = {
     24  by: "coarseType",
     25  objects: { by: "objectClass", then: BUCKET, other: BUCKET },
     26  strings: BUCKET,
     27  scripts: {
     28    by: "filename",
     29    then: { by: "internalType", then: BUCKET },
     30    noFilename: { by: "internalType", then: BUCKET },
     31  },
     32  other: { by: "internalType", then: BUCKET },
     33 };
     34 
     35 function run_test() {
     36  assertCountToBucketBreakdown(BREAKDOWN, EXPECTED);
     37 }