Skip to content

Commit

Permalink
chore: uncomment subscriptions HOC test to run against React 18
Browse files Browse the repository at this point in the history
  • Loading branch information
alessbell committed Mar 15, 2023
1 parent 5b8f2e2 commit 34e2c23
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
3 changes: 1 addition & 2 deletions config/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,14 @@ const react18TestFileIgnoreList = [
// to avoid running them twice with both react versions
// since they do not import react
ignoreTSFiles,
// failing hoc tests (8)
// failing hoc tests (7)
'src/react/hoc/__tests__/mutations/queries.test.tsx',
'src/react/hoc/__tests__/mutations/recycled-queries.test.tsx',
'src/react/hoc/__tests__/queries/errors.test.tsx',
'src/react/hoc/__tests__/queries/lifecycle.test.tsx',
'src/react/hoc/__tests__/queries/loading.test.tsx',
'src/react/hoc/__tests__/queries/observableQuery.test.tsx',
'src/react/hoc/__tests__/queries/skip.test.tsx',
'src/react/hoc/__tests__/subscriptions/subscriptions.test.tsx',
// failing components tests (1)
'src/react/components/__tests__/client/Query.test.tsx',
];
Expand Down
30 changes: 21 additions & 9 deletions src/react/hoc/__tests__/subscriptions/subscriptions.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { itAsync, MockSubscriptionLink } from '../../../../testing';
import { graphql } from '../../graphql';
import { ChildProps } from '../../types';

const IS_REACT_18 = React.version.startsWith("18");

describe('subscriptions', () => {
let error: typeof console.error;

Expand Down Expand Up @@ -298,20 +300,30 @@ describe('subscriptions', () => {
expect(loading).toBeFalsy();
if (count === 0)
expect(user).toEqual(results[0].result.data.user);
if (count === 1)
expect(user).toEqual(results[0].result.data.user);
if (count === 1) {
if (IS_REACT_18) {
expect(user).toEqual(results[1].result.data.user);
} else {
expect(user).toEqual(results[0].result.data.user);
}
}
if (count === 2)
expect(user).toEqual(results[2].result.data.user);
if (count === 3)
expect(user).toEqual(results[2].result.data.user);
if (count === 4)
expect(user).toEqual(
results3[2].result.data.user
);
if (count === 4) {
if (IS_REACT_18) {
expect(user).toEqual(results[2].result.data.user);
} else {
expect(user).toEqual(results3[2].result.data.user);
}
}
if (count === 5) {
expect(user).toEqual(
results3[2].result.data.user
);
if (IS_REACT_18) {
expect(user).toEqual(results3[3].result.data.user);
} else {
expect(user).toEqual(results3[2].result.data.user);
}
resolve();
}
} catch (e) {
Expand Down

0 comments on commit 34e2c23

Please sign in to comment.