| 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 | describe('ReactSymbols', () => { |
| 12 | beforeEach(() => jest.resetModules()); |
| 13 | |
| 14 | const expectToBeUnique = keyValuePairs => { |
| 15 | const map = new Map(); |
| 16 | keyValuePairs.forEach(([key, value]) => { |
| 17 | if (map.has(value)) { |
| 18 | throw Error( |
| 19 | `${key} value ${value.toString()} is the same as ${map.get(value)}.`, |
| 20 | ); |
| 21 | } |
| 22 | map.set(value, key); |
| 23 | }); |
| 24 | }; |
| 25 | |
| 26 | it('Symbol values should be unique', () => { |
| 27 | expectToBeUnique(Object.entries(require('shared/ReactSymbols'))); |
| 28 | }); |
| 29 | }); |