summaryrefslogtreecommitdiffstats
path: root/toolkit/components/ml/tests/browser/browser_ml_utils.js
blob: c215349af492ebfd3ef5ea0ab9713b74964a7b92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";

const { arrayBufferToBlobURL } = ChromeUtils.importESModule(
  "chrome://global/content/ml/Utils.sys.mjs"
);

/**
 * Test arrayBufferToBlobURL function.
 */
add_task(async function test_ml_utils_array_buffer_to_blob_url() {
  const buffer = new ArrayBuffer(8);
  const blobURL = arrayBufferToBlobURL(buffer);

  Assert.equal(
    typeof blobURL,
    "string",
    "arrayBufferToBlobURL should return a string"
  );
  Assert.equal(
    blobURL.startsWith("blob:"),
    true,
    "The returned string should be a Blob URL"
  );
});