Skip to content

Commit

Permalink
fixed build error, replaced concat-stream-es6 package with concat-stream
Browse files Browse the repository at this point in the history
and converted some inferno-server tests to tsx for Github#1632
  • Loading branch information
Havunen committed Mar 16, 2024
1 parent 2fd100e commit 527f088
Show file tree
Hide file tree
Showing 12 changed files with 325 additions and 299 deletions.
577 changes: 300 additions & 277 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"@typescript-eslint/eslint-plugin": "^6.21.0",
"babel-plugin-inferno": "6.7.1",
"cli-table": "^0.3.11",
"concat-stream-es6": "0.0.1",
"concat-stream": "^2.0.0",
"coveralls-next": "^4.2.0",
"cross-env": "^7.0.3",
"d3-scale-chromatic": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/inferno-router/src/Prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component, type InfernoNode } from 'inferno';
import { invariant } from './utils';

export interface IPromptProps {
when: any;
when?: boolean;
message: string;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('A <StaticRouter>', () => {
});

it('context.router.staticContext persists inside of a <Route>', () => {
const ContextChecker = (props, reactContext) => {
const ContextChecker = (_props, reactContext) => {
expect(typeof reactContext.router).toBe('object');
expect(reactContext.router.staticContext).toBe(context);
return null;
Expand All @@ -43,7 +43,7 @@ describe('A <StaticRouter>', () => {
});

it('provides context.router.history', () => {
const ContextChecker = (props, reactContext) => {
const ContextChecker = (_props, reactContext) => {
expect(typeof reactContext.router.history).toBe('object');
return null;
};
Expand All @@ -65,12 +65,12 @@ describe('A <StaticRouter>', () => {
const context = {};
const history = {};

spyOn(console, 'error');
const spy = spyOn(console, 'error');

renderToStaticMarkup(<StaticRouter context={context} history={history} />);

expect(console.error).toHaveBeenCalledTimes(1);
expect(console.error.calls.argsFor(0)[0]).toContain(
expect(spy).toHaveBeenCalledTimes(1);
expect(spy.calls.argsFor(0)[0]).toContain(
'<StaticRouter> ignores the history prop',
);
// expect(console.error).toHaveBeenCalledWith(
Expand All @@ -79,7 +79,7 @@ describe('A <StaticRouter>', () => {
});

it('reports PUSH actions on the context object', () => {
const context = {};
const context: Record<string, any> = {};

renderToStaticMarkup(
<StaticRouter context={context}>
Expand All @@ -92,7 +92,7 @@ describe('A <StaticRouter>', () => {
});

it('reports REPLACE actions on the context object', () => {
const context = {};
const context: Record<string, any> = {};

renderToStaticMarkup(
<StaticRouter context={context}>
Expand Down Expand Up @@ -169,7 +169,7 @@ describe('A <StaticRouter>', () => {
});

it('reports PUSH actions on the context object', () => {
const context = {};
const context: Record<string, any> = {};

renderToStaticMarkup(
<StaticRouter context={context} basename="/the-base">
Expand All @@ -182,7 +182,7 @@ describe('A <StaticRouter>', () => {
});

it('reports REPLACE actions on the context object', () => {
const context = {};
const context: Record<string, any> = {};

renderToStaticMarkup(
<StaticRouter context={context} basename="/the-base">
Expand All @@ -197,10 +197,15 @@ describe('A <StaticRouter>', () => {

describe('no basename', () => {
it('createHref does not append extra leading slash', () => {
const context = {};
const context: Record<string, any> = {};
const pathname = '/test-path-please-ignore';

const Link = ({ to, children }) => (
interface ILinkProps {
to: string;
children?: any;
}

const Link = ({ to, children }: ILinkProps) => (
<Route
children={({ history: { createHref } }) => (
<a href={createHref(to)}>{children}</a>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component } from 'inferno';
import { streamQueueAsString } from 'inferno-server';

import concatStream from 'concat-stream-es6';
import concatStream from 'concat-stream';
import { createElement } from 'inferno-create-element';

class StatefulComponent extends Component {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, render } from 'inferno';
import { createElement } from 'inferno-create-element';
import { streamAsStaticMarkup } from 'inferno-server';
import concatStream from 'concat-stream-es6';
import concatStream from 'concat-stream';

describe('SSR Root Creation Streams - (non-JSX)', () => {
let container;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component } from 'inferno';
import { streamAsString } from 'inferno-server';
import concatStream from 'concat-stream-es6';
import concatStream from 'concat-stream';
import { createElement } from 'inferno-create-element';

class StatefulComponent extends Component {
Expand Down
2 changes: 1 addition & 1 deletion packages/inferno-server/__tests__/security.spec.server.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
streamAsString,
streamQueueAsString,
} from 'inferno-server';
import concatStream from 'concat-stream-es6';
import concatStream from 'concat-stream';

describe('Security - SSR', () => {
describe('renderToString', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/inferno-server/__tests__/ssr-forwardref.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from 'inferno-server';
import { hydrate } from 'inferno-hydrate';
import { isString } from 'inferno-shared';
import concatStream from 'concat-stream-es6';
import concatStream from 'concat-stream';

describe('SSR -> Hydrate - Forward Ref', () => {
let container;
Expand Down
1 change: 1 addition & 0 deletions packages/inferno-test-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
type VNode,
type InfernoChild,
type InfernoFragment,
type Inferno,
} from 'inferno';
import {
isArray,
Expand Down
5 changes: 1 addition & 4 deletions packages/inferno/__tests__/forceUpdate.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,7 @@ describe('forceUpdate', () => {
};

public shouldComponentUpdate(_prevProps, prevState) {
if (prevState.foo !== this.state.foo) {
return true;
}
return false;
return prevState.foo !== this.state.foo;
}

public componentDidMount() {
Expand Down

0 comments on commit 527f088

Please sign in to comment.