From feb1a2ff94a3412644bfd81c59536ea02827519b Mon Sep 17 00:00:00 2001 From: Vasco Santos Date: Tue, 20 Jul 2021 14:53:27 +0200 Subject: [PATCH] chore: use web-std blob for typeof --- packages/ipfs-core-utils/package.json | 1 + .../ipfs-core-utils/test/files/normalise-input.spec.js | 10 +++------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/packages/ipfs-core-utils/package.json b/packages/ipfs-core-utils/package.json index f37161a509..838f6c1091 100644 --- a/packages/ipfs-core-utils/package.json +++ b/packages/ipfs-core-utils/package.json @@ -59,6 +59,7 @@ "uint8arrays": "^2.1.6" }, "devDependencies": { + "@web-std/blob": "^2.1.1", "@web-std/file": "^1.1.0", "aegir": "^34.0.2", "rimraf": "^3.0.2" diff --git a/packages/ipfs-core-utils/test/files/normalise-input.spec.js b/packages/ipfs-core-utils/test/files/normalise-input.spec.js index 1b2ec38964..94dd2bfbc9 100644 --- a/packages/ipfs-core-utils/test/files/normalise-input.spec.js +++ b/packages/ipfs-core-utils/test/files/normalise-input.spec.js @@ -6,8 +6,9 @@ const { expect } = require('aegir/utils/chai') const blobToIt = require('blob-to-it') const uint8ArrayFromString = require('uint8arrays/from-string') const all = require('it-all') +const { Blob } = require('@web-std/blob') const { File } = require('@web-std/file') -const { Blob, ReadableStream } = globalThis +const { ReadableStream } = globalThis const { isBrowser, isWebWorker, isElectronRenderer } = require('ipfs-utils/src/env') let normalise = require('../../src/files/normalise-input') @@ -36,12 +37,7 @@ async function verifyNormalisation (input) { let content = input[0].content if (isBrowser || isWebWorker || isElectronRenderer) { - try { - expect(content).to.be.an.instanceOf(Blob) - } catch (err) { - // Fallback to instance of File - expect(content).to.be.an.instanceOf(File) - } + expect(content).to.be.an.instanceOf(Blob) content = blobToIt(content) }