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

Commit

Permalink
Lint test suite, fix ESLint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmaj committed Nov 4, 2022
1 parent 0470c91 commit 779a813
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"scripts": {
"build": "babel --source-maps=both src -d build",
"clean": "rimraf build",
"lint": "eslint src --ext .jsx,.js",
"lint": "eslint src test --ext .jsx,.js",
"postinstall": "husky install",
"prepack": "yarn clean && yarn build",
"prettier": "prettier --check . --cache",
Expand Down
4 changes: 2 additions & 2 deletions test/test/Adapter-spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1151,13 +1151,13 @@ describe('Adapter', () => {

describe('.wrap()', () => {
it('returns a valid element', () => {
const element = <div a="b" c="d" />;
const element = <div data-a="b" data-c="d" />;
const wrapped = adapter.wrap(element);
expect(adapter.isValidElement(wrapped)).to.equal(true);
});

it('renders the children provided', () => {
const element = <div a="b" c="d" />;
const element = <div data-a="b" data-c="d" />;
const wrapped = adapter.wrap(element);
expect(wrapped.props).to.contain.keys({ children: element });
});
Expand Down
12 changes: 6 additions & 6 deletions test/test/Debug-spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ describe('debug', () => {

// FIXME: Fails for @wojtekmaj/enzyme-adapter-react-17
it.skip('renders symbol props', () => {
expect(debugElement(<div symbol={Symbol.iterator} other={Symbol('foo')} />)).to.equal(
'<div symbol={[Symbol(Symbol.iterator)]} other={[Symbol(foo)]} />',
);
expect(
debugElement(<div data-symbol={Symbol.iterator} data-other={Symbol('foo')} />),
).to.equal('<div data-symbol={[Symbol(Symbol.iterator)]} data-other={[Symbol(foo)]} />');
});

it('renders children on newline and indented', () => {
Expand Down Expand Up @@ -273,9 +273,9 @@ describe('debug', () => {
});

it('renders boxed primitives as the primitive', () => {
expect(debugElement(<div a={Object('foo')} b={Object(3)} c={Object(true)} />)).to.equal(
'<div a="foo" b={3} c={true} />',
);
expect(
debugElement(<div data-a={Object('foo')} data-b={Object(3)} data-c={Object(true)} />),
).to.equal('<div data-a="foo" data-b={3} data-c={true} />');
});
});

Expand Down
22 changes: 13 additions & 9 deletions test/test/Utils-spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,13 @@ describe('Utils', () => {
});

it('tests deepEquality with object props', () => {
expect(nodeEqual(<div foo={{ a: 1, b: 2 }} />, <div foo={{ a: 1, b: 2 }} />)).to.equal(true);
expect(
nodeEqual(<div data-foo={{ a: 1, b: 2 }} />, <div data-foo={{ a: 1, b: 2 }} />),
).to.equal(true);

expect(nodeEqual(<div foo={{ a: 2, b: 2 }} />, <div foo={{ a: 1, b: 2 }} />)).to.equal(false);
expect(
nodeEqual(<div data-foo={{ a: 2, b: 2 }} />, <div data-foo={{ a: 1, b: 2 }} />),
).to.equal(false);
});

describe('children props', () => {
Expand Down Expand Up @@ -340,13 +344,13 @@ describe('Utils', () => {
});

it('tests deepEquality with object props', () => {
expect(nodeMatches(<div foo={{ a: 1, b: 2 }} />, <div foo={{ a: 1, b: 2 }} />)).to.equal(
true,
);
expect(
nodeMatches(<div data-foo={{ a: 1, b: 2 }} />, <div data-foo={{ a: 1, b: 2 }} />),
).to.equal(true);

expect(nodeMatches(<div foo={{ a: 2, b: 2 }} />, <div foo={{ a: 1, b: 2 }} />)).to.equal(
false,
);
expect(
nodeMatches(<div data-foo={{ a: 2, b: 2 }} />, <div data-foo={{ a: 1, b: 2 }} />),
).to.equal(false);
});

describe('children props', () => {
Expand Down Expand Up @@ -417,7 +421,7 @@ describe('Utils', () => {
),
).to.equal(true);

expect(nodeMatches(<div foo="" />, <div foo={0} />)).to.equal(false);
expect(nodeMatches(<div data-foo="" />, <div data-foo={0} />)).to.equal(false);

expect(nodeMatches(<div />, <div>{0}</div>)).to.equal(false);
});
Expand Down

0 comments on commit 779a813

Please sign in to comment.