Skip to content

Commit ae477b3

Browse files
committed
Refactor.
1 parent 24c80f3 commit ae477b3

File tree

5 files changed

+36
-28
lines changed

5 files changed

+36
-28
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# react-hooks-shared-state
22
[![npm version](https://badge.fury.io/js/react-hooks-shared-state.svg)](https://www.npmjs.com/package/react-hooks-shared-state)
3+
[![CircleCI](https://circleci.com/gh/kelp404/react-hooks-shared-state.svg?style=svg)](https://circleci.com/gh/kelp404/react-hooks-shared-state)
34

45
A global state for React with Hooks API.
56

__tests__/lib/__snapshots__/shared-state.js.snap

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3+
exports[`Setter it was generated execute without path. 1`] = `
4+
Object {
5+
"test": true,
6+
}
7+
`;
8+
39
exports[`setState() is assign state and call setters. 1`] = `
410
Object {
511
"test": true,

__tests__/lib/shared-state.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,10 @@ test('setState() is assign state and call setters.', () => {
1616
expect(shareState.setters[0].set).toBeCalledWith(true);
1717
expect(shareState.setters[1].set).toBeCalledWith({test: true});
1818
});
19+
20+
test('Setter it was generated execute without path.', () => {
21+
const shareState = new SharedState();
22+
const setState = shareState.generateSetState();
23+
setState({test: true});
24+
expect(shareState.state).toMatchSnapshot();
25+
});

example/dist/app.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)