mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-26 20:39:08 +01:00
107525bb1d
* Show error message if service worker did not load (respond to the UI) after 1 minute. Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com> * Remove console.log Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com> * New Error message design Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com> * Fix tests Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com> * Use lastTimeStamp instead of keeping track of message ids Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com> * Do not initial channe every second. Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com> * New logic to check if SW is stuck Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com> Signed-off-by: Akintayo A. Olusegun <akintayo.segun@gmail.com>
54 lines
1.7 KiB
JavaScript
54 lines
1.7 KiB
JavaScript
import { fetchLocale } from '../../ui/helpers/utils/i18n-helper';
|
|
import { SUPPORT_LINK } from './ui-utils';
|
|
import { getErrorHtml } from './error-utils';
|
|
|
|
jest.mock('../../ui/helpers/utils/i18n-helper', () => ({
|
|
fetchLocale: jest.fn(),
|
|
loadRelativeTimeFormatLocaleData: jest.fn(),
|
|
}));
|
|
|
|
describe('Error utils Tests', function () {
|
|
it('should get error html', async function () {
|
|
const mockStore = {
|
|
localeMessages: {
|
|
current: {
|
|
troubleStarting: {
|
|
message:
|
|
'MetaMask had trouble starting. This error could be intermittent, so try restarting the extension.',
|
|
},
|
|
restartMetamask: {
|
|
message: 'Restart MetaMask',
|
|
},
|
|
stillGettingMessage: {
|
|
message: 'Still getting this message?',
|
|
},
|
|
sendBugReport: {
|
|
message: 'Send us a bug report.',
|
|
},
|
|
},
|
|
},
|
|
metamask: {
|
|
currentLocale: 'en',
|
|
},
|
|
};
|
|
|
|
fetchLocale.mockReturnValue(mockStore.localeMessages.current);
|
|
const errorHtml = await getErrorHtml(
|
|
'troubleStarting',
|
|
SUPPORT_LINK,
|
|
mockStore.metamask,
|
|
);
|
|
const currentLocale = mockStore.localeMessages.current;
|
|
const troubleStartingMessage = currentLocale.troubleStarting.message;
|
|
const restartMetamaskMessage = currentLocale.restartMetamask.message;
|
|
const stillGettingMessageMessage =
|
|
currentLocale.stillGettingMessage.message;
|
|
const sendBugReportMessage = currentLocale.sendBugReport.message;
|
|
|
|
expect(errorHtml).toContain(troubleStartingMessage);
|
|
expect(errorHtml).toContain(restartMetamaskMessage);
|
|
expect(errorHtml).toContain(stillGettingMessageMessage);
|
|
expect(errorHtml).toContain(sendBugReportMessage);
|
|
});
|
|
});
|