ArpitB

Untitled

Jul 23rd, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. add_task(async () => {
  2.   info("URI sent when record in DB");
  3.   const client = RemoteSettings("public-suffix-list");
  4.   const collection = await client.openCollection();
  5.   await collection.clear(); // Empty the collection
  6.   await collection.create(
  7.     {
  8.       id: "tld-dafsa",
  9.       "commit-hash": "fake-commit-hash",
  10.       attachment: {
  11.         hash: "fake-hash",
  12.         size: 37837,
  13.         filename: "dafsa.bin",
  14.         location:
  15.           "main-workspace/public-suffix-list/1bb15755-b13e-4795-a185-34668a885f0a.bin",
  16.         mimetype: "application/octet-stream",
  17.       },
  18.     },
  19.     { synced: true }
  20.   );
  21.  
  22.   const backup = client.attachments.download;
  23.   client.attachments.download = async rec => {
  24.     console.log("ran");
  25.     return "file://mocked";
  26.   };
  27.   // Downloader.prototype.download = async rec => {
  28.   //   console.log("ran");
  29.   //   return `${rec.id}/fileURI`;
  30.   // };
  31.  
  32.   const promiseSignal = TestUtils.topicObserved("public-suffix-list-updated");
  33.   PublicSuffixList.init();
  34.   const observed = await promiseSignal;
  35.   Assert.equal(observed, "file://mocked");
  36.  
  37.   await collection.clear();
  38.   client.attachments.download = backup;
  39. });
Add Comment
Please, Sign In to add comment