Skip to content

Commit

Permalink
Update jest to fix warning with mocked function (auth0#941)
Browse files Browse the repository at this point in the history
  • Loading branch information
frederikprijck authored Aug 5, 2022
1 parent 91c5be3 commit bb4277b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
6 changes: 2 additions & 4 deletions __tests__/storage.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import * as esCookie from 'es-cookie';
import { MockedObject } from 'ts-jest/dist/utils/testing';
import { mocked } from 'ts-jest/utils';
import { CookieStorage, CookieStorageWithLegacySameSite } from '../src/storage';

jest.mock('es-cookie');
Expand All @@ -9,7 +7,7 @@ describe('CookieStorage', () => {
let cookieMock;

beforeEach(() => {
cookieMock = mocked(esCookie);
cookieMock = jest.mocked(esCookie);
});

it('saves a cookie', () => {
Expand Down Expand Up @@ -85,7 +83,7 @@ describe('CookieStorageWithLegacySameSite', () => {
let cookieMock;

beforeEach(() => {
cookieMock = mocked(esCookie);
cookieMock = jest.mocked(esCookie);
});

it('saves object', () => {
Expand Down
3 changes: 1 addition & 2 deletions __tests__/transaction-manager.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import TransactionManager from '../src/transaction-manager';
import { SessionStorage } from '../src/storage';
import { TEST_CLIENT_ID, TEST_STATE } from './constants';
import { mocked } from 'ts-jest/utils';

const TRANSACTION_KEY_PREFIX = 'a0.spajs.txs';

Expand Down Expand Up @@ -40,7 +39,7 @@ describe('transaction manager', () => {
});

it('`create` creates the transaction', () => {
mocked(sessionStorage.getItem).mockReturnValue(transactionJson);
jest.mocked(sessionStorage.getItem).mockReturnValue(transactionJson);
tm.create(transaction);
expect(tm.get()).toMatchObject(transaction);
});
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"gzip-size": "^6.0.0",
"husky": "^7.0.4",
"idtoken-verifier": "^2.2.2",
"jest": "^27.3.1",
"jest": "^27.5.1",
"jest-junit": "^13.0.0",
"jest-localstorage-mock": "^2.4.18",
"jsonwebtoken": "^8.5.1",
Expand Down

0 comments on commit bb4277b

Please sign in to comment.