11import { bytesToHex } from '@metamask/utils' ;
22// eslint-disable-next-line n/no-unsupported-features/node-builtins
33import { webcrypto } from 'crypto' ;
4+ import { describe , expect , it , vi } from 'vitest' ;
45
56import {
67 hmacSha512 ,
@@ -21,7 +22,7 @@ describe('hmacSha512', () => {
2122 const data = new Uint8Array ( 32 ) ;
2223
2324 const hash = new Uint8Array ( 64 ) . fill ( 1 ) ;
24- const customHmacSha512 = jest . fn ( ) . mockResolvedValue ( hash ) ;
25+ const customHmacSha512 = vi . fn ( ) . mockResolvedValue ( hash ) ;
2526
2627 const result = await hmacSha512 ( key , data , {
2728 hmacSha512 : customHmacSha512 ,
@@ -42,7 +43,7 @@ describe('hmacSha512', () => {
4243 } ) ;
4344
4445 it ( 'returns the HMAC-SHA-512 when using the fallback' , async ( ) => {
45- jest . spyOn ( utils , 'isWebCryptoSupported' ) . mockReturnValueOnce ( false ) ;
46+ vi . spyOn ( utils , 'isWebCryptoSupported' ) . mockReturnValueOnce ( false ) ;
4647
4748 const key = new Uint8Array ( 32 ) ;
4849 const data = new Uint8Array ( 32 ) ;
@@ -73,7 +74,7 @@ describe('pbkdf2Sha512', () => {
7374 const keyLength = 64 ;
7475
7576 const hash = new Uint8Array ( 64 ) . fill ( 1 ) ;
76- const customPbkdf2Sha512 = jest . fn ( ) . mockResolvedValue ( hash ) ;
77+ const customPbkdf2Sha512 = vi . fn ( ) . mockResolvedValue ( hash ) ;
7778
7879 const result = await pbkdf2Sha512 ( password , salt , iterations , keyLength , {
7980 pbkdf2Sha512 : customPbkdf2Sha512 ,
@@ -101,7 +102,7 @@ describe('pbkdf2Sha512', () => {
101102 } ) ;
102103
103104 it ( 'returns the PBKDF2-SHA-512 when using the fallback' , async ( ) => {
104- jest . spyOn ( utils , 'isWebCryptoSupported' ) . mockReturnValueOnce ( false ) ;
105+ vi . spyOn ( utils , 'isWebCryptoSupported' ) . mockReturnValueOnce ( false ) ;
105106
106107 const password = new Uint8Array ( 32 ) ;
107108 const salt = new Uint8Array ( 32 ) ;
0 commit comments