Skip to content

Commit

Permalink
test: adding test for error check on <Subscribe>
Browse files Browse the repository at this point in the history
  • Loading branch information
willmendesneto authored and jamiebuilds committed Oct 17, 2018
1 parent a1e879f commit d1e330e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions __tests__/unstated.js
Expand Up @@ -75,3 +75,10 @@ test('should remove subscriber listeners if component is unmounted', () => {
expect(counter._listeners.length).toBe(0);
expect(testInstance.unmounted).toBe(true);
});

test('should throw an error if <Subscribe> component is not wrapper with <Provider>', () => {
spyOn(console, 'error');
expect(() => render(<Counter />)).toThrowError(
'You must wrap your <Subscribe> components with a <Provider>'
);
});
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -60,10 +60,10 @@
"collectCoverageFrom": ["src/**/*.js"],
"coverageThreshold": {
"global": {
"lines": 80,
"statements": 78,
"lines": 82,
"statements": 80,
"functions": 90,
"branches": 45
"branches": 50
}
}
}
Expand Down

0 comments on commit d1e330e

Please sign in to comment.