Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: improve
  • Loading branch information
Dunqing committed Aug 14, 2023
commit c201c66a1a83c261ff49a32c5e7fc694fa1b5a83
26 changes: 13 additions & 13 deletions packages/expect-utils/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,23 +398,23 @@ export const arrayBufferEquality = (
dataViewB = new DataView(b);
}

if (dataViewA instanceof DataView && dataViewB instanceof DataView) {
// Buffers are not equal when they do not have the same byte length
if (dataViewA.byteLength !== dataViewB.byteLength) {
return false;
}
if (!(dataViewA instanceof DataView && dataViewB instanceof DataView)) {
return undefined;
}

// Check if every byte value is equal to each other
for (let i = 0; i < dataViewA.byteLength; i++) {
if (dataViewA.getUint8(i) !== dataViewB.getUint8(i)) {
return false;
}
}
// Buffers are not equal when they do not have the same byte length
if (dataViewA.byteLength !== dataViewB.byteLength) {
return false;
}

return true;
// Check if every byte value is equal to each other
for (let i = 0; i < dataViewA.byteLength; i++) {
if (dataViewA.getUint8(i) !== dataViewB.getUint8(i)) {
return false;
}
}

return undefined;
return true;
};

export const sparseArrayEquality = (
Expand Down