-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
show error when api_key changed (and automatically reset) (#18)
- Loading branch information
1 parent
c70fe56
commit 9f3331e
Showing
22 changed files
with
574 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
export const props = { message: 'some notification' } | ||
|
||
export const storeStateMock = { | ||
boards: { | ||
isLoading: false, | ||
error: null, | ||
}, | ||
lists: { | ||
'board-1': { | ||
isLoading: false, | ||
error: null, | ||
}, | ||
}, | ||
members: { | ||
isLoading: false, | ||
error: null, | ||
}, | ||
} | ||
|
||
export const storeWithBoardError = { | ||
boards: { | ||
isLoading: false, | ||
error: { | ||
status: 401, | ||
responseText: 'example response', | ||
}, | ||
}, | ||
} | ||
|
||
export const storeWithAnyError = { | ||
user: { | ||
error: { message: 'some error user message ' }, | ||
}, | ||
} |
39 changes: 39 additions & 0 deletions
39
src/components/notification/__tests__/__snapshots__/component.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Component/Notification should render without throwing an error 1`] = ` | ||
<WithStyles(Snackbar) | ||
ContentProps={ | ||
Object { | ||
"aria-describedby": "message-id", | ||
} | ||
} | ||
action={ | ||
Array [ | ||
<WithStyles(IconButton) | ||
aria-label="Close" | ||
className="Notification-close-1" | ||
color="inherit" | ||
onClick={[Function]} | ||
> | ||
<pure(Close) /> | ||
</WithStyles(IconButton)>, | ||
] | ||
} | ||
anchorOrigin={ | ||
Object { | ||
"horizontal": "right", | ||
"vertical": "bottom", | ||
} | ||
} | ||
autoHideDuration={10000} | ||
message={ | ||
<span | ||
id="message-id" | ||
> | ||
Test Message | ||
</span> | ||
} | ||
onClose={[Function]} | ||
open={true} | ||
/> | ||
`; |
41 changes: 0 additions & 41 deletions
41
src/components/notification/__tests__/__snapshots__/index.test.js.snap
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import React from 'react' | ||
import { shallow } from 'enzyme' | ||
|
||
import Snackbar from '@material-ui/core/Snackbar' | ||
|
||
import Notification from '../component' | ||
|
||
describe('Component/Notification', () => { | ||
const props = { | ||
message: 'Test Message', | ||
} | ||
|
||
test('should render without throwing an error', () => { | ||
const wrapper = shallow(<Notification {...props} />).dive() | ||
expect(wrapper).toMatchSnapshot() | ||
expect(wrapper.find(Snackbar)).toHaveLength(1) | ||
}) | ||
|
||
test('should render null when message is not present', () => { | ||
const wrapper = shallow(<Notification />).dive() | ||
expect(wrapper.html()).toEqual(null) | ||
}) | ||
|
||
test('should have a default open state of false when no props.message is available', () => { | ||
const wrapper = shallow(<Notification />).dive() | ||
const instance = wrapper.instance() | ||
expect(instance.state).toEqual({ open: false }) | ||
}) | ||
|
||
test('should have a default open state of true when props.message is available', () => { | ||
const wrapper = shallow(<Notification {...props} />).dive() | ||
const instance = wrapper.instance() | ||
expect(instance.state).toEqual({ open: true }) | ||
}) | ||
|
||
test('should adjust the autoHideDuration when props.autoHideDuration is set', () => { | ||
const wrapper = shallow(<Notification {...props} autoHideDuration={1000} />).dive() | ||
expect(wrapper.find(Snackbar).prop('autoHideDuration')).toEqual(1000) | ||
}) | ||
|
||
test('should return undefined when handleClose was called with reason "clickaway"', () => { | ||
const wrapper = shallow(<Notification {...props} />).dive() | ||
const instance = wrapper.instance() | ||
expect(instance.handleClose(null, 'clickaway')).toBe(undefined) | ||
}) | ||
|
||
test('should change the state of state.open when handleClose was called with another reason than "clickaway"', () => { | ||
const wrapper = shallow(<Notification {...props} />).dive() | ||
const instance = wrapper.instance() | ||
|
||
expect(instance.state).toEqual({ open: true }) | ||
instance.handleClose(null) | ||
expect(instance.state).toEqual({ open: false }) | ||
}) | ||
}) |
Oops, something went wrong.