invertObject-test.js — react Source File
Architecture documentation for invertObject-test.js, a javascript file in the react codebase.
Entity Profile
Relationship Graph
Source Code
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
const invertObject = require('../invertObject');
const objectValues = target => Object.keys(target).map(key => target[key]);
describe('invertObject', () => {
it('should return an empty object for an empty input', () => {
expect(invertObject({})).toEqual({});
});
it('should invert key-values', () => {
expect(
invertObject({
a: '3',
b: '4',
})
).toEqual({
3: 'a',
4: 'b',
});
});
it('should take the last value when there are duplications in vals', () => {
expect(
invertObject({
a: '3',
b: '4',
c: '3',
})
).toEqual({
4: 'b',
3: 'c',
});
});
it('should preserve the original order', () => {
expect(
Object.keys(
invertObject({
a: '3',
b: '4',
c: '3',
})
)
).toEqual(['3', '4']);
expect(
objectValues(
invertObject({
a: '3',
b: '4',
c: '3',
})
)
).toEqual(['c', 'b']);
});
});
Domain
Subdomains
Functions
Source
Frequently Asked Questions
What does invertObject-test.js do?
invertObject-test.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Optimization subdomain.
What functions are defined in invertObject-test.js?
invertObject-test.js defines 1 function(s): objectValues.
Where is invertObject-test.js in the architecture?
invertObject-test.js is located at scripts/error-codes/__tests__/invertObject-test.js (domain: BabelCompiler, subdomain: Optimization, directory: scripts/error-codes/__tests__).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free