File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
packages/firestore/src/remote Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @firebase/firestore " : patch
3+ ---
4+
5+ Fix internal assertion due to Buffer value not evaluating to instanceof Uint8Array, encountered when testing with jsdom.
Original file line number Diff line number Diff line change @@ -262,8 +262,14 @@ export function fromBytes(
262262 return ByteString . fromBase64String ( value ? value : '' ) ;
263263 } else {
264264 hardAssert (
265- value === undefined || value instanceof Uint8Array ,
266- 'value must be undefined or Uint8Array'
265+ value === undefined ||
266+ // Check if the value is an instance of both Buffer and Uint8Array,
267+ // despite the fact that Buffer extends Uint8Array. In some
268+ // environments, such as jsdom, the prototype chain of Buffer
269+ // does not indicate that it extends Uint8Array.
270+ value instanceof Buffer ||
271+ value instanceof Uint8Array ,
272+ 'value must be undefined, Buffer, or Uint8Array'
267273 ) ;
268274 return ByteString . fromUint8Array ( value ? value : new Uint8Array ( ) ) ;
269275 }
You can’t perform that action at this time.
0 commit comments