mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 01:47:00 +01:00
fix: Remove sentry warning on undefined
TokenListController
(#20547)
* fix sentry warning * correct test * switch to using spyOn method
This commit is contained in:
parent
e543fca211
commit
e6cd452506
@ -724,7 +724,9 @@ describe('migration #88', () => {
|
||||
expect(newStorage.data).toStrictEqual(oldData);
|
||||
});
|
||||
|
||||
it('captures an exception 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 oldData = {
|
||||
TokensController: {},
|
||||
NftController: {
|
||||
@ -760,13 +762,15 @@ describe('migration #88', () => {
|
||||
};
|
||||
|
||||
await migrate(oldStorage);
|
||||
expect(sentryCaptureExceptionMock).toHaveBeenCalledTimes(1);
|
||||
expect(sentryCaptureExceptionMock).toHaveBeenCalledWith(
|
||||
expect(mockWarnFn).toHaveBeenCalledTimes(1);
|
||||
expect(mockWarnFn).toHaveBeenCalledWith(
|
||||
new Error(`typeof state.TokenListController is undefined`),
|
||||
);
|
||||
});
|
||||
|
||||
it('captures an exception 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 oldData = {
|
||||
TokensController: {},
|
||||
NftController: {
|
||||
@ -803,8 +807,8 @@ describe('migration #88', () => {
|
||||
};
|
||||
|
||||
await migrate(oldStorage);
|
||||
expect(sentryCaptureExceptionMock).toHaveBeenCalledTimes(1);
|
||||
expect(sentryCaptureExceptionMock).toHaveBeenCalledWith(
|
||||
expect(mockWarnFn).toHaveBeenCalledTimes(1);
|
||||
expect(mockWarnFn).toHaveBeenCalledWith(
|
||||
new Error(`typeof state.TokenListController is boolean`),
|
||||
);
|
||||
});
|
||||
|
@ -164,7 +164,7 @@ function migrateData(state: Record<string, unknown>): void {
|
||||
);
|
||||
}
|
||||
} else {
|
||||
global.sentry?.captureException?.(
|
||||
console.warn(
|
||||
new Error(
|
||||
`typeof state.TokenListController is ${typeof state.TokenListController}`,
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user