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