Skip to content

Commit

Permalink
Fixed some lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jmyrland authored and ctrlplusb committed Aug 19, 2019
1 parent 82ced29 commit 740d1a4
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 16 deletions.
10 changes: 7 additions & 3 deletions src/__tests__/computed.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable react/prop-types */

import React from 'react';
import { act } from 'react-dom/test-utils';
import produce from 'immer-peasy';
Expand All @@ -18,7 +20,7 @@ test('immer-peasy works as expected', () => {

// act
Object.defineProperty(original, 'fullName', {
get: () => original.firstName + ' ' + original.lastName,
get: () => `${original.firstName} ${original.lastName}`,
});

// assert
Expand Down Expand Up @@ -120,12 +122,14 @@ test('computed properties are memoized', () => {
expect(computedCount).toBe(0);

// act
// eslint-disable-next-line no-unused-expressions
store.getState().fullName;

// assert
expect(computedCount).toBe(1);

// act
// eslint-disable-next-line no-unused-expressions
store.getState().fullName;

// assert
Expand Down Expand Up @@ -205,7 +209,7 @@ test('computed properties are available in actions', () => {
const store = createStore({
todos: ['test computed'],
todosCount: computed(state => state.todos.length),
testAction: action((state, payload) => {
testAction: action(state => {
// assert
expect(state.todosCount).toBe(1);
}),
Expand Down Expand Up @@ -237,7 +241,7 @@ test('computed properties work in a React component', () => {
},
other: {
foo: 'bar',
setFoo: action((state, payload) => {
setFoo: action(state => {
state.foo = 'bar';
}),
},
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/create-component-store.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,15 @@ it('multiple instances', async () => {

it('with initial data', () => {
// arrange
// eslint-disable-next-line no-shadow
const useCounter = createComponentStore(data => ({
count: data.count || 0,
inc: action(state => {
state.count += 1;
}),
}));

// eslint-disable-next-line no-shadow
function CountDisplay() {
const [state, actions] = useCounter({ count: 1 });
return (
Expand Down
9 changes: 0 additions & 9 deletions src/__tests__/react.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,3 @@ describe('direct form', () => {
expect(renderSpy).toHaveBeenCalledTimes(1);
});
});

test('issue230', () => {
// arrange
const renderSpy = jest.fn();

// act

// assert
});
4 changes: 2 additions & 2 deletions src/__tests__/testing/thunks.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ describe('with mocking actions', () => {
// act
try {
await store.getActions().throwing('A payload');
} catch (err) {
} catch (thrownError) {
// assert
expect(err.message).toEqual('poop');
expect(thrownError.message).toEqual('poop');
}

// assert
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/thunks.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ test('dispatch an action via redux dispatch', async () => {
dispatch({ type: 'INCREMENT' });
}),
},
counter: reducer((state = 0, action) => {
switch (action.type) {
counter: reducer((state = 0, incomingAction) => {
switch (incomingAction.type) {
case 'INCREMENT':
return state + 1;
default:
Expand Down

0 comments on commit 740d1a4

Please sign in to comment.