Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Add strict mode + skip batch test for now #30

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@
"devDependencies": {
"@arkweid/lefthook": "^0.7.2",
"@changesets/cli": "^2.6.5",
"@testing-library/react": "^10.0.2",
"@testing-library/react": "^11.2.7",
"@types/jest": "^25.2.1",
"@types/react": "^16.9.32",
"@types/react-dom": "^16.9.6",
"doctoc": "^1.4.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react": "^18.0.0-alpha-01be61c12",
"react-dom": "^18.0.0-alpha-01be61c12",
"tsdx": "^0.13.1",
"tslib": "^1.11.1",
"typescript": "^4.0.3"
Expand Down
51 changes: 42 additions & 9 deletions test/useEffectReducer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ describe('useEffectReducer', () => {
);
};

const { getByTestId } = render(<Fetcher />);
const { getByTestId } = render(
<React.StrictMode>
<Fetcher />
</React.StrictMode>
);

const resultEl = getByTestId('result');

Expand Down Expand Up @@ -197,7 +201,11 @@ describe('useEffectReducer', () => {
);
};

const { getByTestId } = render(<Fetcher />);
const { getByTestId } = render(
<React.StrictMode>
<Fetcher />
</React.StrictMode>
);

const resultEl = getByTestId('result');

Expand All @@ -210,7 +218,8 @@ describe('useEffectReducer', () => {
});
});

it('handles batched dispatch calls', () => {
// Skipping until https://github.com/testing-library/react-testing-library/pull/925 is merged
it.skip('handles batched dispatch calls', () => {
interface ThingContext {
count: number;
}
Expand Down Expand Up @@ -251,7 +260,11 @@ describe('useEffectReducer', () => {
return <div data-testid="count">{state.count}</div>;
};

const { getByTestId } = render(<Thing />);
const { getByTestId } = render(
<React.StrictMode>
<Thing />
</React.StrictMode>
);

expect(getByTestId('count').textContent).toEqual('5');

Expand Down Expand Up @@ -290,7 +303,11 @@ describe('useEffectReducer', () => {
);
};

const { getByTestId } = render(<Thing />);
const { getByTestId } = render(
<React.StrictMode>
<Thing />
</React.StrictMode>
);

expect(getByTestId('count').textContent).toEqual('0');

Expand Down Expand Up @@ -362,7 +379,11 @@ describe('useEffectReducer', () => {
return <div data-testid="count">{state.count}</div>;
};

const { getByTestId } = render(<Thing />);
const { getByTestId } = render(
<React.StrictMode>
<Thing />
</React.StrictMode>
);

expect(getByTestId('count').textContent).toEqual('5');

Expand Down Expand Up @@ -428,7 +449,11 @@ describe('useEffectReducer', () => {
);
};

const { getByTestId } = render(<App />);
const { getByTestId } = render(
<React.StrictMode>
<App />
</React.StrictMode>
);

const statusEl = getByTestId('status');
const buttonEl = getByTestId('hide');
Expand Down Expand Up @@ -502,7 +527,11 @@ describe('useEffectReducer', () => {
);
};

const { getByTestId } = render(<App />);
const { getByTestId } = render(
<React.StrictMode>
<App />
</React.StrictMode>
);

const helloButton = getByTestId('send-hello');
const goodbyeButton = getByTestId('send-goodbye');
Expand Down Expand Up @@ -594,7 +623,11 @@ describe('useEffectReducer', () => {
return <div data-testid="result">{state.data || '--'}</div>;
};

const { getByTestId } = render(<App />);
const { getByTestId } = render(
<React.StrictMode>
<App />
</React.StrictMode>
);
expect(started).toBeTruthy();
const result = getByTestId('result');

Expand Down
Loading