main
js 41 lines 1.39 KB
Raw
1 /**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 * @emails react-core
8 */
9 'use strict';
10
11 let formatProdErrorMessage;
12
13 describe('ReactErrorProd', () => {
14 beforeEach(() => {
15 jest.resetModules();
16 formatProdErrorMessage = require('shared/formatProdErrorMessage').default;
17 });
18
19 it('should throw with the correct number of `%s`s in the URL', () => {
20 expect(formatProdErrorMessage(124, 'foo', 'bar')).toEqual(
21 'Minified React error #124; visit ' +
22 'https://react.dev/errors/124?args[]=foo&args[]=bar' +
23 ' for the full message or use the non-minified dev environment' +
24 ' for full errors and additional helpful warnings.',
25 );
26
27 expect(formatProdErrorMessage(20)).toEqual(
28 'Minified React error #20; visit ' +
29 'https://react.dev/errors/20' +
30 ' for the full message or use the non-minified dev environment' +
31 ' for full errors and additional helpful warnings.',
32 );
33
34 expect(formatProdErrorMessage(77, '<div>', '&?bar')).toEqual(
35 'Minified React error #77; visit ' +
36 'https://react.dev/errors/77?args[]=%3Cdiv%3E&args[]=%26%3Fbar' +
37 ' for the full message or use the non-minified dev environment' +
38 ' for full errors and additional helpful warnings.',
39 );
40 });
41 });