Skip to content

Commit 7d4d6ed

Browse files
committed
All integration and unit tests green
1 parent e0047a0 commit 7d4d6ed

File tree

3 files changed

+16
-28
lines changed

3 files changed

+16
-28
lines changed

.vscode/launch.json

-18
This file was deleted.

src/index.spec.tsx

+10-10
Original file line numberDiff line numberDiff line change
@@ -1175,12 +1175,12 @@ describe('reactElementToJSXString(ReactElement)', () => {
11751175
});
11761176

11771177
it('should use inferred function name as display name for `forwardRef` element', () => {
1178-
const Tag = React.forwardRef(function Tag({ text }, ref) {
1178+
const Tag = React.forwardRef(function TagWithRef({ text }, ref) {
11791179
return <span ref={ref}>{text}</span>;
11801180
});
11811181

11821182
expect(reactElementToJSXString(<Tag text="some label" />)).toEqual(
1183-
`<Tag text="some label" />`
1183+
`<TagWithRef text="some label" />`
11841184
);
11851185
});
11861186

@@ -1196,12 +1196,12 @@ describe('reactElementToJSXString(ReactElement)', () => {
11961196
});
11971197

11981198
it('should use inferred function name as display name for `memo` element', () => {
1199-
const Tag = React.memo(function Tag({ text }) {
1199+
const Tag = React.memo(function TagMemoized({ text }) {
12001200
return <span>{text}</span>;
12011201
});
12021202

12031203
expect(reactElementToJSXString(<Tag text="some label" />)).toEqual(
1204-
`<Tag text="some label" />`
1204+
`<TagMemoized text="some label" />`
12051205
);
12061206
});
12071207

@@ -1218,27 +1218,27 @@ describe('reactElementToJSXString(ReactElement)', () => {
12181218

12191219
it('should use inferred function name as display name for a `forwardRef` wrapped in `memo`', () => {
12201220
const Tag = React.memo(
1221-
React.forwardRef(function Tag({ text }, ref) {
1221+
React.forwardRef(function TagWithRef({ text }, ref) {
12221222
return <span ref={ref}>{text}</span>;
12231223
})
12241224
);
12251225

12261226
expect(reactElementToJSXString(<Tag text="some label" />)).toEqual(
1227-
`<Tag text="some label" />`
1227+
`<TagWithRef text="some label" />`
12281228
);
12291229
});
12301230

12311231
it('should use inferred function name as display name for a component wrapped in `memo` multiple times', () => {
12321232
const Tag = React.memo(
12331233
React.memo(
1234-
React.memo(function Tag({ text }) {
1234+
React.memo(function TagReallyMemoized({ text }) {
12351235
return <span>{text}</span>;
12361236
})
12371237
)
12381238
);
12391239

12401240
expect(reactElementToJSXString(<Tag text="some label" />)).toEqual(
1241-
`<Tag text="some label" />`
1241+
`<TagReallyMemoized text="some label" />`
12421242
);
12431243
});
12441244

@@ -1370,7 +1370,7 @@ describe('reactElementToJSXString(ReactElement)', () => {
13701370
return tags;
13711371
}
13721372

1373-
const Tag = React.forwardRef(function Tag({ text }, ref) {
1373+
const Tag = React.forwardRef(function TagWithRef({ text }, ref) {
13741374
return <span ref={ref}>{text}</span>;
13751375
});
13761376
Tag.emotionReal = Tag;
@@ -1381,7 +1381,7 @@ describe('reactElementToJSXString(ReactElement)', () => {
13811381
)
13821382
).toEqual(`<TagList
13831383
tags={[
1384-
<Tag key="oops" text="oops, circular"/>
1384+
<TagWithRef key="oops" text="oops, circular"/>
13851385
]}
13861386
/>`);
13871387
});

tests/setupTests.ts

+6
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
11
import '@testing-library/jest-dom/vitest';
2+
import { cleanup } from '@testing-library/react';
3+
import { beforeEach } from 'vitest';
4+
5+
beforeEach(() => {
6+
cleanup();
7+
});

0 commit comments

Comments
 (0)