prompt
stringlengths
183
7.33M
completion
stringlengths
13
833k
__index_level_0__
int64
0
215k
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './import-token';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
100
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './dropdown-search-list';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
101
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './select-quote-popover';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
102
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './sort-list';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
103
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './quote-details';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
104
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './token-allowance';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
105
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './desktop-error.container';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
106
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './confirm-contract-interaction';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
107
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './account-list';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
108
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './institutional-entity-done-page';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
109
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './confirm-add-custodian-token';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
110
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: import InteractiveReplacementTokenPage from './interactive-replacement-token-page'; export default InteractiveReplacementTokenPage;
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
111
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './custody';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
112
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './confirm-connect-custodian-modal';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
113
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './confirm-approve';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
114
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './confirm-approve-content.component';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
115
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './confirm-token-transaction-base';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
116
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './lock.container';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
117
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './confirmation';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
118
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: import { omit, pick } from 'lodash'; import { ApprovalType } from '@metamask/controller-utils'; import { rejectPendingApproval, resolvePendingApproval, setNewNetworkAdded, upsertNetworkConfiguration, } from '../../../store/actions'; ///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps) import { SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES } from '../../../../shared/constants/app'; import createSnapAccount from './create-snap-account'; import removeSnapAccount from './remove-snap-account'; import snapAccountRedirect from './snap-account-redirect'; ///: END:ONLY_INCLUDE_IF import addEthereumChain from './add-ethereum-chain'; import switchEthereumChain from './switch-ethereum-chain'; import success from './success'; import error from './error'; ///: BEGIN:ONLY_INCLUDE_IF(snaps) import snapAlert from './snaps/snap-alert/snap-alert'; import snapConfirmation from './snaps/snap-confirmation/snap-confirmation'; import snapPrompt from './snaps/snap-prompt/snap-prompt'; ///: END:ONLY_INCLUDE_IF const APPROVAL_TEMPLATES = { [ApprovalType.AddEthereumChain]: addEthereumChain, [ApprovalType.SwitchEthereumChain]: switchEthereumChain, // Use ApprovalType from utils controller [ApprovalType.ResultSuccess]: success, [ApprovalType.ResultError]: error, ///: BEGIN:ONLY_INCLUDE_IF(snaps) [ApprovalType.SnapDialogAlert]: snapAlert, [ApprovalType.SnapDialogConfirmation]: snapConfirmation, [ApprovalType.SnapDialogPrompt]: snapPrompt, ///: END:ONLY_INCLUDE_IF ///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps) [SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.confirmAccountCreation]: createSnapAccount, [SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.confirmAccountRemoval]: removeSnapAccount, [SNAP_MANAGE_ACCOUNTS_CONFIRMATION_TYPES.showSnapAccountRedirect]: snapAccountRedirect, ///: END:ONLY_INCLUDE_IF }; export const TEMPLATED_CONFIRMATION_APPROVAL_TYPES = Object.keys(APPROVAL_TEMPLATES); const ALLOWED_TEMPLATE_KEYS = [ 'cancelText', 'content', 'onCancel', 'onSubmit', 'networkDisplay', 'submitText', 'loadingText', ]; /** * @typedef {object} PendingApproval * @property {string} id - The randomly generated id of the approval * @property {string} origin - The origin of the site requesting this approval * @property {number} time - The time the approval was requested * @property {string} type - The type of approval being requested * @property {object} requestData - The data submitted with the request */ /** * getTemplateAlerts calls the getAlerts function exported by the template if * it exists, and then returns the result of that function. In the confirmation * page the alerts returned from the getAlerts method will be set into the * alertState state object. * * @param {object} pendingApproval - the object representing the confirmation * @param {object} state - The state object consist of required info to determine alerts. */ export async function getTemplateAlerts(pendingApproval, state) { const fn = APPROVAL_TEMPLATES[pendingApproval.type]?.getAlerts; const results = fn ? await fn(pendingApproval, state) : []; if (!Array.isArray(results)) { throw new Error(`Template alerts must be an array, received: ${results}`); } if (results.some((result) => result?.id === undefined)) { throw new Error( `Template alert entries must be objects with an id key. Received: ${results}`, ); } return results; } /** * The function call to return state must be a promise returning function * this "NOOP" is here to conform to the requirements for templates without * state. */ async function emptyState() { return {}; } /** * getTemplateState calls the getState function exported by the template if * it exists, and then returns the result of that function. In the confirmation * page the object returned from the getState method will be set into the * confirmationState state object. Note, this state is not consumed by the page * itself. * * @param {object} pendingApproval - the object representing the confirmation */ export async function getTemplateState(pendingApproval) { const fn = APPROVAL_TEMPLATES[pendingApproval.type]?.getState ?? emptyState; const result = await fn(pendingApproval); if (typeof result !== 'object' || Array.isArray(result)) { throw new Error(`Template state must be an object, received: ${result}`); } else if (result === null || result === undefined) { return {}; } return result; } /** * We do not want to pass the entire dispatch function to the template. * This function should return an object of actions that we generally consider * to be safe for templates to invoke. In the future we could put these behind * permission sets so that snaps that wish to manipulate state must ask for * explicit permission to do so. * * @param {Function} dispatch - Redux dispatch function */ function getAttenuatedDispatch(dispatch) { return { rejectPendingApproval: (...args) => dispatch(rejectPendingApproval(...args)), resolvePendingApproval: (...args) => dispatch(resolvePendingApproval(...args)), upsertNetworkConfiguration: (...args) => dispatch(upsertNetworkConfiguration(...args)), setNewNetworkAdded: (...args) => dispatch(setNewNetworkAdded(...args)), }; } /** * Returns the templated values to be consumed in the confirmation page * * @param {object} pendingApproval - The pending confirmation object. * @param {Function} t - Translation function. * @param {Function} dispatch - Redux dispatch function. * @param {object} history - The application's history object. * @param {Function} setInputState - A function that can be used to record the * state of input fields in the templated component. * @param {object} data - The data object passed into the template from the confimation page. */ export function getTemplateValues( pendingApproval, t, dispatch, history, setInputState, data, ) { const fn = APPROVAL_TEMPLATES[pendingApproval.type]?.getValues; if (!fn) { throw new Error( `MESSAGE_TYPE: '${pendingApproval.type}' is not specified in approval templates`, ); } const safeActions = getAttenuatedDispatch(dispatch); const values = fn( pendingApproval, t, safeActions, history, setInputState, data, ); const extraneousKeys = omit(values, ALLOWED_TEMPLATE_KEYS); const safeValues = pick(values, ALLOWED_TEMPLATE_KEYS); if (extraneousKeys.length > 0) { throw new Error( `Received extraneous keys from ${ pendingApproval.type }.getValues. These keys are not passed to the confirmation page: ${Object.keys( extraneousKeys, )}`, ); } return safeValues; }
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
119
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './confirmation-footer';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
120
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './confirmation-network-switch';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
121
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: import React from 'react'; import { useDispatch } from 'react-redux'; import { useI18nContext } from '../../../hooks/useI18nContext'; import { hideModal } from '../../../store/actions'; import Typography from '../../../components/ui/typography/typography'; import Box from '../../../components/ui/box/box'; import { TEXT_ALIGN, TypographyVariant, FONT_WEIGHT, } from '../../../helpers/constants/design-system'; import NetworksForm from '../../settings/networks-tab/networks-form/networks-form'; export default function AddNetworkModal() { const dispatch = useDispatch(); const t = useI18nContext(); const closeCallback = () => dispatch(hideModal({ name: 'ONBOARDING_ADD_NETWORK' })); return ( <> <Box paddingTop={4}> <Typography variant={TypographyVariant.H4} align={TEXT_ALIGN.CENTER} fontWeight={FONT_WEIGHT.BOLD} > {t('onboardingMetametricsModalTitle')} </Typography> </Box> <NetworksForm addNewNetwork restrictHeight networksToRender={[]} cancelCallback={closeCallback} submitCallback={closeCallback} /> </> ); }
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
122
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './confirm-send-ether';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
123
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './confirm-send-token';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
124
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './error.component';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
125
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: import PropTypes from 'prop-types'; import React, { useEffect, useState, useCallback, useMemo } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { useHistory, withRouter } from 'react-router-dom'; import log from 'loglevel'; import { cloneDeep } from 'lodash'; import { SubjectType } from '@metamask/permission-controller'; import { TransactionStatus } from '@metamask/transaction-controller'; import * as actions from '../../store/actions'; import txHelper from '../../helpers/utils/tx-helper'; import SignatureRequest from '../../components/app/signature-request'; import SignatureRequestSIWE from '../../components/app/signature-request-siwe'; import SignatureRequestOriginal from '../../components/app/signature-request-original'; import Loading from '../../components/ui/loading-screen'; import { useRouting } from '../../hooks/useRouting'; import { getTotalUnapprovedSignatureRequestCount, ///: BEGIN:ONLY_INCLUDE_IF(build-mmi) getSelectedAccount, ///: END:ONLY_INCLUDE_IF getTargetSubjectMetadata, getCurrentNetworkTransactions, getUnapprovedTransactions, } from '../../selectors'; import { MESSAGE_TYPE } from '../../../shared/constants/app'; import { getSendTo } from '../../ducks/send'; import { getProviderConfig } from '../../ducks/metamask/metamask'; const signatureSelect = (txData, targetSubjectMetadata) => { const { type, msgParams: { version, siwe }, } = txData; // Temporarily direct only v3 and v4 requests to new code. if ( type === MESSAGE_TYPE.ETH_SIGN_TYPED_DATA && (version === 'V3' || version === 'V4') ) { return SignatureRequest; } if (siwe?.isSIWEMessage && targetSubjectMetadata !== SubjectType.Snap) { return SignatureRequestSIWE; } return SignatureRequestOriginal; }; const ConfirmTxScreen = ({ match }) => { const dispatch = useDispatch(); const { navigateToMostRecentOverviewPage } = useRouting(); const unapprovedMessagesTotal = useSelector( getTotalUnapprovedSignatureRequestCount, ); const sendTo = useSelector(getSendTo); const { identities, currentCurrency, unapprovedMsgs, unapprovedPersonalMsgs, unapprovedTypedMessages, blockGasLimit, } = useSelector((state) => state.metamask); const unapprovedTxs = useSelector(getUnapprovedTransactions); const currentNetworkTxList = useSelector(getCurrentNetworkTransactions); const { chainId } = useSelector(getProviderConfig); const { txId: index } = useSelector((state) => state.appState); ///: BEGIN:ONLY_INCLUDE_IF(build-mmi) const selectedAccount = useSelector(getSelectedAccount); ///: END:ONLY_INCLUDE_IF const [prevValue, setPrevValues] = useState(); const history = useHistory(); useEffect(() => { const unconfTxList = txHelper( unapprovedTxs || {}, {}, {}, {}, {}, {}, chainId, ); if (unconfTxList.length === 0 && !sendTo && unapprovedMessagesTotal === 0) { navigateToMostRecentOverviewPage(); } }, [ chainId, navigateToMostRecentOverviewPage, sendTo, unapprovedMessagesTotal, unapprovedTxs, ]); useEffect( () => { if (!prevValue) { setPrevValues({ index, unapprovedTxs }); return; } let prevTx; const { params: { id: transactionId } = {} } = match; if (transactionId) { prevTx = currentNetworkTxList.find( ({ id }) => `${id}` === transactionId, ); } else { const { index: prevIndex, unapprovedTxs: prevUnapprovedTxs } = prevValue; const prevUnconfTxList = txHelper( prevUnapprovedTxs, {}, {}, {}, {}, {}, chainId, ); const prevTxData = prevUnconfTxList[prevIndex] || {}; prevTx = currentNetworkTxList.find(({ id }) => id === prevTxData.id) || {}; } const unconfTxList = txHelper( unapprovedTxs || {}, {}, {}, {}, {}, {}, chainId, ); if (prevTx && prevTx.status === TransactionStatus.dropped) { dispatch( actions.showModal({ name: 'TRANSACTION_CONFIRMED', onSubmit: () => navigateToMostRecentOverviewPage(), }), ); return; } if ( unconfTxList.length === 0 && !sendTo && unapprovedMessagesTotal === 0 ) { navigateToMostRecentOverviewPage(); } setPrevValues({ index, unapprovedTxs }); }, // eslint-disable-next-line react-hooks/exhaustive-deps [], ); const getTxData = useCallback(() => { const { params: { id: transactionId } = {} } = match; const unconfTxList = txHelper( unapprovedTxs || {}, unapprovedMsgs, unapprovedPersonalMsgs, {}, {}, unapprovedTypedMessages, chainId, ); log.info(`rendering a combined ${unconfTxList.length} unconf msgs & txs`); const unconfirmedTx = transactionId ? unconfTxList.find(({ id }) => `${id}` === transactionId) : unconfTxList[index]; return cloneDeep(unconfirmedTx); }, [ chainId, index, match, unapprovedMsgs, unapprovedPersonalMsgs, unapprovedTxs, unapprovedTypedMessages, ]); const txData = useMemo(() => getTxData() || {}, [getTxData]); const targetSubjectMetadata = useSelector((state) => getTargetSubjectMetadata(state, txData.msgParams?.origin), ); if (!txData.msgParams) { return <Loading />; } const SigComponent = signatureSelect(txData, targetSubjectMetadata); return ( <SigComponent history={history} txData={txData} key={txData.id} identities={identities} currentCurrency={currentCurrency} blockGasLimit={blockGasLimit} ///: BEGIN:ONLY_INCLUDE_IF(build-mmi) selectedAccount={selectedAccount} ///: END:ONLY_INCLUDE_IF /> ); }; ConfirmTxScreen.propTypes = { match: PropTypes.shape({ params: PropTypes.shape({ id: PropTypes.string, }), }), }; export default withRouter(ConfirmTxScreen);
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
126
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './permissions-connect.container';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
127
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './permissions-redirect.component';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
128
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './choose-account';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
129
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './snaps-connect';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
130
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './snap-install';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
131
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './snap-result';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
132
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './snap-update';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
133
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: import UnlockPage from './unlock-page.container'; export default UnlockPage;
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
134
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './connected-sites.container';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
135
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './connected-accounts.container';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
136
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './routes.container';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
137
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './create-account.component';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
138
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import * as actions from '../../../store/actions'; import { getCurrentChainId, getMetaMaskAccounts, getRpcPrefsForCurrentProvider, getMetaMaskAccountsConnected, } from '../../../selectors'; import { formatBalance } from '../../../helpers/utils/util'; import { getMostRecentOverviewPage } from '../../../ducks/history/history'; import { MetaMetricsEventAccountType, MetaMetricsEventCategory, MetaMetricsEventName, } from '../../../../shared/constants/metametrics'; import { SECOND } from '../../../../shared/constants/time'; import { HardwareDeviceNames, LedgerTransportTypes, } from '../../../../shared/constants/hardware-wallets'; import { BUTTON_VARIANT, BUTTON_SIZES, Button, Text, } from '../../../components/component-library'; import ZENDESK_URLS from '../../../helpers/constants/zendesk-url'; import { TextColor } from '../../../helpers/constants/design-system'; import SelectHardware from './select-hardware'; import AccountList from './account-list'; const U2F_ERROR = 'U2F'; const LEDGER_LIVE_PATH = `m/44'/60'/0'/0/0`; const MEW_PATH = `m/44'/60'/0'`; const BIP44_PATH = `m/44'/60'/0'/0`; export const LEDGER_HD_PATHS = [ { name: 'Ledger Live', value: LEDGER_LIVE_PATH }, { name: 'Legacy (MEW / MyCrypto)', value: MEW_PATH }, { name: `BIP44 Standard (e.g. MetaMask, Trezor)`, value: BIP44_PATH }, ]; const LATTICE_STANDARD_BIP44_PATH = `m/44'/60'/0'/0/x`; const LATTICE_LEDGER_LIVE_PATH = `m/44'/60'/x'/0/0`; const LATTICE_MEW_PATH = `m/44'/60'/0'/x`; export const LATTICE_HD_PATHS = [ { name: `Standard (${LATTICE_STANDARD_BIP44_PATH})`, value: LATTICE_STANDARD_BIP44_PATH, }, { name: `Ledger Live (${LATTICE_LEDGER_LIVE_PATH})`, value: LATTICE_LEDGER_LIVE_PATH, }, { name: `Ledger Legacy (${LATTICE_MEW_PATH})`, value: LATTICE_MEW_PATH }, ]; const TREZOR_TESTNET_PATH = `m/44'/1'/0'/0`; export const TREZOR_HD_PATHS = [ { name: `BIP44 Standard (e.g. MetaMask, Trezor)`, value: BIP44_PATH }, { name: `Legacy (Ledger / MEW / MyCrypto)`, value: MEW_PATH }, { name: `Trezor Testnets`, value: TREZOR_TESTNET_PATH }, ]; const HD_PATHS = { ledger: LEDGER_HD_PATHS, lattice: LATTICE_HD_PATHS, trezor: TREZOR_HD_PATHS, }; class ConnectHardwareForm extends Component { static contextTypes = { t: PropTypes.func, }; state = { error: null, selectedAccounts: [], accounts: [], browserSupported: true, unlocked: false, device: null, isFirefox: false, }; UNSAFE_componentWillReceiveProps(nextProps) { const { accounts } = nextProps; const newAccounts = this.state.accounts.map((a) => { const normalizedAddress = a.address.toLowerCase(); const balanceValue = accounts[normalizedAddress]?.balance || null; a.balance = balanceValue ? formatBalance(balanceValue, 6) : '...'; return a; }); this.setState({ accounts: newAccounts }); } componentDidMount() { this.checkIfUnlocked(); const useAgent = window.navigator.userAgent; if (/Firefox/u.test(useAgent)) { this.setState({ isFirefox: true }); } } async checkIfUnlocked() { for (const device of [ HardwareDeviceNames.trezor, HardwareDeviceNames.ledger, HardwareDeviceNames.lattice, ]) { const path = this.props.defaultHdPaths[device]; const unlocked = await this.props.checkHardwareStatus(device, path); if (unlocked) { this.setState({ unlocked: true }); this.getPage(device, 0, path); } } } connectToHardwareWallet = (device) => { this.setState({ device }); if (this.state.accounts.length) { return; } // Default values this.getPage(device, 0, this.props.defaultHdPaths[device]); }; onPathChange = (path) => { this.props.setHardwareWalletDefaultHdPath({ device: this.state.device, path, }); this.setState({ selectedAccounts: [], }); this.getPage(this.state.device, 0, path); }; onAccountChange = (account) => { let { selectedAccounts } = this.state; if (selectedAccounts.includes(account)) { selectedAccounts = selectedAccounts.filter((acc) => account !== acc); } else { selectedAccounts.push(account); } this.setState({ selectedAccounts, error: null }); }; onAccountRestriction = () => { this.setState({ error: this.context.t('ledgerAccountRestriction') }); }; showTemporaryAlert() { this.props.showAlert(this.context.t('hardwareWalletConnected')); // Autohide the alert after 5 seconds setTimeout((_) => { this.props.hideAlert(); }, SECOND * 5); } getPage = (device, page, hdPath) => { this.props .connectHardware(device, page, hdPath, this.context.t) .then((accounts) => { if (accounts.length) { // If we just loaded the accounts for the first time // (device previously locked) show the global alert if (this.state.accounts.length === 0 && !this.state.unlocked) { this.showTemporaryAlert(); } // Map accounts with balances const newAccounts = accounts.map((account) => { const normalizedAddress = account.address.toLowerCase(); const balanceValue = this.props.accounts[normalizedAddress]?.balance || null; account.balance = balanceValue ? formatBalance(balanceValue, 6) : '...'; return account; }); this.setState({ accounts: newAccounts, unlocked: true, device, error: null, }); } }) .catch((e) => { const errorMessage = typeof e === 'string' ? e : e.message; if (errorMessage === 'Window blocked') { this.setState({ browserSupported: false, error: null }); } else if (errorMessage.includes(U2F_ERROR)) { this.setState({ error: U2F_ERROR }); } else if ( errorMessage === 'LEDGER_LOCKED' || errorMessage === 'LEDGER_WRONG_APP' ) { this.setState({ error: this.context.t('ledgerLocked'), }); } else if (errorMessage.includes('timeout')) { this.setState({ error: this.context.t('ledgerTimeout'), }); } else if ( errorMessage .toLowerCase() .includes( 'KeystoneError#pubkey_account.no_expected_account'.toLowerCase(), ) ) { this.setState({ error: this.context.t('QRHardwarePubkeyAccountOutOfRange'), }); } else if ( errorMessage !== 'Window closed' && errorMessage !== 'Popup closed' && errorMessage .toLowerCase() .includes('KeystoneError#sync_cancel'.toLowerCase()) === false ) { this.setState({ error: errorMessage, }); } }); }; onForgetDevice = (device) => { this.props .forgetDevice(device) .then((_) => { this.setState({ error: null, selectedAccounts: [], accounts: [], unlocked: false, }); }) .catch((e) => { this.setState({ error: e.message }); }); }; onUnlockAccounts = (device, path) => { const { history, mostRecentOverviewPage, unlockHardwareWalletAccounts } = this.props; const { selectedAccounts } = this.state; if (selectedAccounts.length === 0) { this.setState({ error: this.context.t('accountSelectionRequired') }); } const description = MEW_PATH === path ? this.context.t('hardwareWalletLegacyDescription') : ''; return unlockHardwareWalletAccounts( selectedAccounts, device, path || null, description, ) .then((_) => { this.context.trackEvent({ category: MetaMetricsEventCategory.Accounts, event: MetaMetricsEventName.AccountAdded, properties: { account_type: MetaMetricsEventAccountType.Hardware, account_hardware_type: device, }, }); history.push(mostRecentOverviewPage); }) .catch((e) => { this.context.trackEvent({ category: MetaMetricsEventCategory.Accounts, event: MetaMetricsEventName.AccountAddFailed, properties: { account_type: MetaMetricsEventAccountType.Hardware, account_hardware_type: device, error: e.message, }, }); this.setState({ error: e.message }); }); }; onCancel = () => { const { history, mostRecentOverviewPage } = this.props; history.push(mostRecentOverviewPage); }; renderError() { if (this.state.error === U2F_ERROR) { if (this.state.device === 'ledger' && this.state.isFirefox) { return ( <> <Text color={TextColor.warningDefault} margin={[5, 5, 2]}> {this.context.t('troubleConnectingToLedgerU2FOnFirefox', [ // eslint-disable-next-line react/jsx-key <Button variant={BUTTON_VARIANT.LINK} href={ZENDESK_URLS.HARDWARE_CONNECTION} size={BUTTON_SIZES.INHERIT} key="u2f-error-1" as="a" block={false} target="_blank" rel="noopener noreferrer" > {this.context.t('troubleConnectingToLedgerU2FOnFirefox2')} </Button>, ])} </Text> <Text color={TextColor.warningDefault} margin={[5, 5, 2]}> {this.context.t( 'troubleConnectingToLedgerU2FOnFirefoxLedgerSolution', [ // eslint-disable-next-line react/jsx-key <Button variant={BUTTON_VARIANT.LINK} href={ZENDESK_URLS.LEDGER_FIREFOX_U2F_GUIDE} size={BUTTON_SIZES.INHERIT} key="u2f-error-1" as="a" target="_blank" rel="noopener noreferrer" > {this.context.t( 'troubleConnectingToLedgerU2FOnFirefoxLedgerSolution2', )} </Button>, ], )} </Text> </> ); } return ( <Text color={TextColor.warningDefault} margin={[5, 5, 2]}> {this.context.t('troubleConnectingToWallet', [ this.state.device, // eslint-disable-next-line react/jsx-key <Button variant={BUTTON_VARIANT.LINK} href={ZENDESK_URLS.HARDWARE_CONNECTION} key="u2f-error-1" > {this.context.t('walletConnectionGuide')} </Button>, ])} </Text> ); } return this.state.error ? ( <span className="hw-connect__error">{this.state.error}</span> ) : null; } renderContent() { if (!this.state.accounts.length) { return ( <SelectHardware connectToHardwareWallet={this.connectToHardwareWallet} browserSupported={this.state.browserSupported} ledgerTransportType={this.props.ledgerTransportType} onCancel={this.onCancel} /> ); } return ( <AccountList onPathChange={this.onPathChange} selectedPath={this.props.defaultHdPaths[this.state.device]} device={this.state.device} accounts={this.state.accounts} connectedAccounts={this.props.connectedAccounts} selectedAccounts={this.state.selectedAccounts} onAccountChange={this.onAccountChange} chainId={this.props.chainId} rpcPrefs={this.props.rpcPrefs} getPage={this.getPage} onUnlockAccounts={this.onUnlockAccounts} onForgetDevice={this.onForgetDevice} onCancel={this.onCancel} onAccountRestriction={this.onAccountRestriction} hdPaths={HD_PATHS} /> ); } render() { return ( <> {this.renderError()} {this.renderContent()} </> ); } } ConnectHardwareForm.propTypes = { connectHardware: PropTypes.func, checkHardwareStatus: PropTypes.func, forgetDevice: PropTypes.func, showAlert: PropTypes.func, hideAlert: PropTypes.func, unlockHardwareWalletAccounts: PropTypes.func, setHardwareWalletDefaultHdPath: PropTypes.func, history: PropTypes.object, chainId: PropTypes.string, rpcPrefs: PropTypes.object, accounts: PropTypes.object, connectedAccounts: PropTypes.array.isRequired, defaultHdPaths: PropTypes.object, mostRecentOverviewPage: PropTypes.string.isRequired, ledgerTransportType: PropTypes.oneOf(Object.values(LedgerTransportTypes)), }; const mapStateToProps = (state) => ({ chainId: getCurrentChainId(state), rpcPrefs: getRpcPrefsForCurrentProvider(state), accounts: getMetaMaskAccounts(state), connectedAccounts: getMetaMaskAccountsConnected(state), defaultHdPaths: state.appState.defaultHdPaths, mostRecentOverviewPage: getMostRecentOverviewPage(state), ledgerTransportType: state.metamask.ledgerTransportType, }); const mapDispatchToProps = (dispatch) => { return { setHardwareWalletDefaultHdPath: ({ device, path }) => { return dispatch(actions.setHardwareWalletDefaultHdPath({ device, path })); }, connectHardware: (deviceName, page, hdPath, t) => { return dispatch(actions.connectHardware(deviceName, page, hdPath, t)); }, checkHardwareStatus: (deviceName, hdPath) => { return dispatch(actions.checkHardwareStatus(deviceName, hdPath)); }, forgetDevice: (deviceName) => { return dispatch(actions.forgetDevice(deviceName)); }, unlockHardwareWalletAccounts: ( indexes, deviceName, hdPath, hdPathDescription, ) => { return dispatch( actions.unlockHardwareWalletAccounts( indexes, deviceName, hdPath, hdPathDescription, ), ); }, showAlert: (msg) => dispatch(actions.showAlert(msg)), hideAlert: () => dispatch(actions.hideAlert()), }; }; ConnectHardwareForm.contextTypes = { t: PropTypes.func, trackEvent: PropTypes.func, }; export default connect( mapStateToProps, mapDispatchToProps, )(ConnectHardwareForm);
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
139
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './confirm-decrypt-message.container';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
140
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: import ConfirmTransactionSwitch from './confirm-transaction-switch.container'; export default ConfirmTransactionSwitch;
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
141
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './confirm-encryption-public-key.container';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
142
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './confirm-add-suggested-token';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
143
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './notifications';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
144
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: import ConfirmTransaction from './confirm-transaction.component'; export default ConfirmTransaction;
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
145
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './confirm-deploy-contract.container';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
146
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './home.container';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
147
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './snap-view';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
148
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './snap-list';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
149
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './disclosure';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
150
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './typography';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
151
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: import Button from './button.component'; export default Button;
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
152
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './list-item.component';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
153
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: import Tabs from './tabs.component'; import Tab from './tab'; export { Tabs, Tab };
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
154
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: import Tab from './tab.component'; export default Tab;
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
155
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: import { DropdownTab } from './dropdown-tab'; export default DropdownTab;
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
156
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './numeric-input.component';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
157
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './color-indicator';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
158
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './chip';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
159
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './show-hide-toggle';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
160
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: import React from 'react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; /** * @deprecated The `<Dialog />` component has been deprecated in favor of the new `<BannerAlert>` component from the component-library. * Please update your code to use the new `<BannerAlert>` component instead, which can be found at ui/components/component-library/banner-alert/banner-alert.js. * You can find documentation for the new `BannerAlert` component in the MetaMask Storybook: * {@link https://metamask.github.io/metamask-storybook/?path=/docs/components-componentlibrary-banneralert--docs} * If you would like to help with the replacement of the old `Dialog` component, please submit a pull request against this GitHub issue: * {@link https://github.com/MetaMask/metamask-extension/issues/20463} */ export default function Dialog(props) { const { children, type, className, onClick } = props; return ( <div className={classnames('dialog', className, { 'dialog--message': type === 'message', 'dialog--error': type === 'error', 'dialog--warning': type === 'warning', })} data-testid="dialog-message" onClick={onClick} > {children} </div> ); } Dialog.propTypes = { className: PropTypes.string, children: PropTypes.node, type: PropTypes.oneOf(['message', 'error', 'warning']), onClick: PropTypes.func, };
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
161
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './mascot.component';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
162
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './site-origin';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
163
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './jazzicon.component';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
164
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './simulation-error-message';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
165
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './icon-with-fallback.component';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
166
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './site-icon';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
167
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './confusable.component';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
168
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './token-input.container';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
169
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './update-nickname-popover';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
170
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default as Menu } from './menu'; export { default as MenuItem } from './menu-item';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
171
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './form-field';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
172
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: import { useSelector } from 'react-redux'; import classNames from 'classnames'; import PropTypes from 'prop-types'; import React from 'react'; import { isMetamaskSuggestedGasEstimate } from '../../../helpers/utils/gas'; import { getGasLoadingAnimationIsShowing } from '../../../ducks/app/app'; import { useShouldAnimateGasEstimations } from '../../../hooks/useShouldAnimateGasEstimations'; const BASE_CLASS = 'loading-heartbeat'; const LOADING_CLASS = `${BASE_CLASS}--active`; export default function LoadingHeartBeat({ estimateUsed, backgroundColor = 'var(--color-background-default)', }) { useShouldAnimateGasEstimations(); const active = useSelector(getGasLoadingAnimationIsShowing); if ( process.env.IN_TEST || (estimateUsed && !isMetamaskSuggestedGasEstimate(estimateUsed)) ) { return null; } return ( <div className={classNames('loading-heartbeat', { [LOADING_CLASS]: active, })} onClick={(e) => { e.preventDefault(); e.stopPropagation(); }} style={{ backgroundColor }} ></div> ); } LoadingHeartBeat.propTypes = { backgroundColor: PropTypes.string, estimateUsed: PropTypes.string, };
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
173
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './review-spending-cap';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
174
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './radio-group.component';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
175
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './sender-to-recipient.component';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
176
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './card';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
177
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './callout';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
178
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './new-network-info';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
179
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './currency-display.component';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
180
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './editable-label';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
181
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: import PageContainerHeader from './page-container-header'; import PageContainerFooter from './page-container-footer'; export { default } from './page-container.component'; export { PageContainerHeader, PageContainerFooter };
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
182
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './page-container-header.component';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
183
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './page-container-footer.component';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
184
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: import Item from './popover.component'; export default Item;
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
185
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './token-balance';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
186
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './qr-code';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
187
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './token-currency-display.component';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
188
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './deprecated-networks';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
189
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './snackbar.component';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
190
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './pulse-loader';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
191
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default, MultipleSizes, MultipleSizesAndAuto, ValidBackgroundColor, ValidBorderColors, } from './box';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
192
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './nft-collection-image';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
193
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: import LoadingScreen from './loading-screen.component'; export default LoadingScreen;
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
194
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: import preloader from './preloader-icon.component'; export default preloader;
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
195
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './icon-button';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
196
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: import Spinner from './spinner.component'; export default Spinner;
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
197
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './dropdown';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
198
Review the shared code context and generate a suite of multiple unit tests for the functions in shared code context using the detected test framework and libraries. Code context: export { default } from './button-group.component';
import { setupLocale } from '../shared/lib/error-utils'; const enMessages = { 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.', }, }; const esMessages = { troubleStarting: { message: 'MetaMask tuvo problemas para iniciarse. Este error podría ser intermitente, así que intente reiniciar la extensión.', }, restartMetamask: { message: 'Reiniciar metamáscara', }, sendBugReport: { message: 'Envíenos un informe de errores.', }, }; jest.mock('../shared/modules/i18n', () => ({ fetchLocale: jest.fn((locale) => (locale === 'en' ? enMessages : esMessages)), loadRelativeTimeFormatLocaleData: jest.fn(), })); describe('Index Tests', () => { it('should get locale messages by calling setupLocale', async () => { let result = await setupLocale('en'); const { currentLocaleMessages: clm, enLocaleMessages: elm } = result; expect(clm).toBeDefined(); expect(elm).toBeDefined(); expect(clm.troubleStarting).toStrictEqual(enMessages.troubleStarting); expect(clm.restartMetamask).toStrictEqual(enMessages.restartMetamask); expect(clm.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm.sendBugReport).toStrictEqual(enMessages.sendBugReport); result = await setupLocale('es'); const { currentLocaleMessages: clm2, enLocaleMessages: elm2 } = result; expect(clm2).toBeDefined(); expect(elm2).toBeDefined(); expect(clm2.troubleStarting).toStrictEqual(esMessages.troubleStarting); expect(clm2.restartMetamask).toStrictEqual(esMessages.restartMetamask); expect(clm2.stillGettingMessage).toBeUndefined(); expect(elm2.stillGettingMessage).toStrictEqual( enMessages.stillGettingMessage, ); expect(clm2.sendBugReport).toStrictEqual(esMessages.sendBugReport); }); });
199