Skip to content

Commit

Permalink
comment
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyMusatkin committed Oct 1, 2024
1 parent 422875f commit 8d684b1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/native/crypto.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ import * as browser from '../browser/crypto';
import {expect} from '@jest/globals';
import type {MatcherFunction} from 'expect';

/*
* Note: jest by default does not compare contents of complex classes like DataView.
* So when comparing two dataviews for equality we equality we always end up with true result because
* the only thing compared is the type of the instance.
* So add a custom comparison operation for it.
* Its possible to make it global for all tests with some additional work.
* Jest 30 is adding DataView equivalence checks out of the box.
*/
const toEqualDataView: MatcherFunction<[expected: DataView]> =
function (actual, expected) {
let dv_actual = actual as DataView;
Expand Down

0 comments on commit 8d684b1

Please sign in to comment.