mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-21 17:37:01 +01:00
fix(20548): fix warning levels in migration file (#20737)
This commit is contained in:
parent
0962e85a1b
commit
8608655886
@ -1,5 +1,8 @@
|
||||
import log from 'loglevel';
|
||||
import { migrate } from './088';
|
||||
|
||||
jest.mock('loglevel');
|
||||
|
||||
const sentryCaptureExceptionMock = jest.fn();
|
||||
|
||||
global.sentry = {
|
||||
@ -725,7 +728,7 @@ describe('migration #88', () => {
|
||||
});
|
||||
|
||||
it('logs a warning if it has no TokenListController property', async () => {
|
||||
const mockWarnFn = jest.spyOn(console, 'warn');
|
||||
const mockWarnFn = jest.spyOn(log, 'warn');
|
||||
|
||||
const oldData = {
|
||||
TokensController: {},
|
||||
@ -762,14 +765,15 @@ describe('migration #88', () => {
|
||||
};
|
||||
|
||||
await migrate(oldStorage);
|
||||
expect(mockWarnFn).toHaveBeenCalledTimes(1);
|
||||
expect(mockWarnFn).toHaveBeenCalledWith(
|
||||
new Error(`typeof state.TokenListController is undefined`),
|
||||
expect(mockWarnFn).toHaveBeenCalledTimes(4);
|
||||
expect(mockWarnFn).toHaveBeenNthCalledWith(
|
||||
1,
|
||||
'typeof state.TokenListController is undefined',
|
||||
);
|
||||
});
|
||||
|
||||
it('logs a warning if the TokenListController property is not an object', async () => {
|
||||
const mockWarnFn = jest.spyOn(console, 'warn');
|
||||
const mockWarnFn = jest.spyOn(log, 'warn');
|
||||
|
||||
const oldData = {
|
||||
TokensController: {},
|
||||
@ -807,9 +811,10 @@ describe('migration #88', () => {
|
||||
};
|
||||
|
||||
await migrate(oldStorage);
|
||||
expect(mockWarnFn).toHaveBeenCalledTimes(1);
|
||||
expect(mockWarnFn).toHaveBeenCalledWith(
|
||||
new Error(`typeof state.TokenListController is boolean`),
|
||||
expect(mockWarnFn).toHaveBeenCalledTimes(4);
|
||||
expect(mockWarnFn).toHaveBeenNthCalledWith(
|
||||
1,
|
||||
'typeof state.TokenListController is boolean',
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -164,10 +164,8 @@ function migrateData(state: Record<string, unknown>): void {
|
||||
);
|
||||
}
|
||||
} else {
|
||||
console.warn(
|
||||
new Error(
|
||||
`typeof state.TokenListController is ${typeof state.TokenListController}`,
|
||||
),
|
||||
log.warn(
|
||||
`typeof state.TokenListController is ${typeof state.TokenListController}`,
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user