blob: d8f5a67ee1f1b4f38903da4c331ac468558df6e8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
export function useMockNavigatorCredentials() {
let oldNavigatorCredentials;
let oldPublicKeyCredential;
beforeEach(() => {
oldNavigatorCredentials = navigator.credentials;
oldPublicKeyCredential = window.PublicKeyCredential;
navigator.credentials = {
get: jest.fn(),
create: jest.fn(),
};
window.PublicKeyCredential = function MockPublicKeyCredential() {};
});
afterEach(() => {
navigator.credentials = oldNavigatorCredentials;
window.PublicKeyCredential = oldPublicKeyCredential;
});
}
|