mirror of
https://github.com/bitwarden/browser
synced 2025-12-21 02:33:46 +00:00
[ADR-0006][AC-319] Migrate all tests to use jest mock instead of substitute (#6520)
Standardize on using jest mock instead of having two mocking frameworks which can be confusing.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { Substitute } from "@fluffy-spoon/substitute";
|
||||
import { mock } from "jest-mock-extended";
|
||||
|
||||
import { Utils } from "../../platform/misc/utils";
|
||||
import { PlatformUtilsService } from "../abstractions/platform-utils.service";
|
||||
@@ -582,8 +581,8 @@ function testRsaGenerateKeyPair(length: 1024 | 2048 | 4096) {
|
||||
}
|
||||
|
||||
function getWebCryptoFunctionService() {
|
||||
const platformUtilsMock = Substitute.for<PlatformUtilsService>();
|
||||
platformUtilsMock.isEdge().mimicks(() => navigator.userAgent.indexOf(" Edg/") !== -1);
|
||||
const platformUtilsMock = mock<PlatformUtilsService>();
|
||||
platformUtilsMock.isEdge.mockImplementation(() => navigator.userAgent.indexOf(" Edg/") !== -1);
|
||||
|
||||
return new WebCryptoFunctionService(window);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user