From 8d684b14d825ed355391d08bbafa1a1481c12c62 Mon Sep 17 00:00:00 2001 From: DmitriyMusatkin Date: Tue, 1 Oct 2024 14:55:04 -0700 Subject: [PATCH] comment --- lib/native/crypto.spec.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/native/crypto.spec.ts b/lib/native/crypto.spec.ts index c98c09d8..5b17a3df 100644 --- a/lib/native/crypto.spec.ts +++ b/lib/native/crypto.spec.ts @@ -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;