Repository URL to install this package:
Version:
1.2.9 ▾
|
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
// @flow
const react_1 = __importDefault(require("react"));
const getComponentName_1 = __importDefault(require("../getComponentName"));
describe('getComponentName', () => {
let Test;
beforeEach(() => {
Test = () => react_1.default.createElement("div", null);
});
it('defaults to reusing the component displayName', () => {
Test.displayName = 'Foo';
expect(getComponentName_1.default(Test)).toEqual('Foo');
});
it('falls back to the class name', () => {
expect(getComponentName_1.default(Test)).toEqual('Test');
});
it('ultimately falls back to "Component"', () => {
Object.defineProperty(Test, 'name', {
value: '',
});
expect(getComponentName_1.default(Test)).toEqual('Component');
});
});
//# sourceMappingURL=getComponentName.test.js.map