-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fixed notification behavior: tapping on a notification should open the app - Improved stability of the app: new tests implemented - Update checker fix: now the app only shows the update icon when a new version is available - Some accessibility improvements
- Loading branch information
Showing
34 changed files
with
1,365 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import {renderHook} from '@testing-library/react-native'; | ||
import {useNotifications} from '../useNotifications'; | ||
import { | ||
initLearningReminder, | ||
resetLearningReminder, | ||
} from '../../../shared/lib/notifications'; | ||
import {EVENT_TYPE, eventBus} from '../../../shared/model/EventBus'; | ||
|
||
jest.mock('../../../shared/lib/notifications', () => ({ | ||
initLearningReminder: jest.fn(), | ||
resetLearningReminder: jest.fn(), | ||
})); | ||
|
||
describe('useNotifications', () => { | ||
it('initialized reminder and reset it on event', () => { | ||
renderHook(() => useNotifications()); | ||
|
||
expect(initLearningReminder).toHaveBeenCalledTimes(1); | ||
|
||
eventBus.emit(EVENT_TYPE.TRAINING_FINISHED); | ||
|
||
expect(resetLearningReminder).toHaveBeenCalledTimes(1); | ||
}); | ||
}); |
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,29 @@ | ||
import {render, screen, userEvent} from '@testing-library/react-native'; | ||
import {About} from '../About'; | ||
import React from 'react'; | ||
import {Linking} from 'react-native'; | ||
|
||
jest.mock('../../../../package.json', () => ({ | ||
version: '1.0', | ||
})); | ||
|
||
describe('About', () => { | ||
it('should match the snapshot', () => { | ||
const {toJSON} = render(<About />); | ||
|
||
expect(toJSON()).toMatchSnapshot(); | ||
}); | ||
|
||
it('should not call onPress when button clicked', async () => { | ||
const spy = jest.spyOn(Linking, 'openURL').mockImplementation(); | ||
|
||
render(<About />); | ||
|
||
const button = screen.getByRole('button'); | ||
|
||
const user = userEvent.setup(); | ||
await user.press(button); | ||
|
||
expect(spy).toHaveBeenCalled(); | ||
}); | ||
}); |
199 changes: 199 additions & 0 deletions
199
src/pages/about/__tests__/__snapshots__/About.test.tsx.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,199 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`About should match the snapshot 1`] = ` | ||
<RCTScrollView> | ||
<View> | ||
<Text | ||
style={ | ||
[ | ||
{ | ||
"textAlign": "left", | ||
}, | ||
{ | ||
"color": "rgba(28, 27, 31, 1)", | ||
"fontFamily": "System", | ||
"fontWeight": "400", | ||
"letterSpacing": 0, | ||
}, | ||
{ | ||
"writingDirection": "ltr", | ||
}, | ||
undefined, | ||
] | ||
} | ||
> | ||
about_text | ||
</Text> | ||
<View | ||
collapsable={false} | ||
style={ | ||
{ | ||
"backgroundColor": "transparent", | ||
"borderRadius": 20, | ||
"shadowColor": "#000", | ||
"shadowOffset": { | ||
"height": 0, | ||
"width": 0, | ||
}, | ||
"shadowOpacity": 0, | ||
"shadowRadius": 0, | ||
} | ||
} | ||
testID="button-container-outer-layer" | ||
> | ||
<View | ||
collapsable={false} | ||
style={ | ||
{ | ||
"backgroundColor": "transparent", | ||
"borderColor": "transparent", | ||
"borderRadius": 20, | ||
"borderStyle": "solid", | ||
"borderWidth": 0, | ||
"flex": undefined, | ||
"minWidth": 64, | ||
"shadowColor": "#000", | ||
"shadowOffset": { | ||
"height": 0, | ||
"width": 0, | ||
}, | ||
"shadowOpacity": 0, | ||
"shadowRadius": 0, | ||
} | ||
} | ||
testID="button-container" | ||
> | ||
<View | ||
accessibilityRole="button" | ||
accessibilityState={ | ||
{ | ||
"busy": undefined, | ||
"checked": undefined, | ||
"disabled": false, | ||
"expanded": undefined, | ||
"selected": undefined, | ||
} | ||
} | ||
accessibilityValue={ | ||
{ | ||
"max": undefined, | ||
"min": undefined, | ||
"now": undefined, | ||
"text": undefined, | ||
} | ||
} | ||
accessible={true} | ||
collapsable={false} | ||
focusable={true} | ||
onBlur={[Function]} | ||
onClick={[Function]} | ||
onFocus={[Function]} | ||
onResponderGrant={[Function]} | ||
onResponderMove={[Function]} | ||
onResponderRelease={[Function]} | ||
onResponderTerminate={[Function]} | ||
onResponderTerminationRequest={[Function]} | ||
onStartShouldSetResponder={[Function]} | ||
style={ | ||
[ | ||
{ | ||
"overflow": "hidden", | ||
}, | ||
{ | ||
"borderRadius": 20, | ||
}, | ||
] | ||
} | ||
testID="button" | ||
> | ||
<View | ||
style={ | ||
[ | ||
{ | ||
"alignItems": "center", | ||
"flexDirection": "row", | ||
"justifyContent": "center", | ||
}, | ||
undefined, | ||
] | ||
} | ||
> | ||
<Text | ||
numberOfLines={1} | ||
selectable={false} | ||
style={ | ||
[ | ||
{ | ||
"textAlign": "left", | ||
}, | ||
{ | ||
"color": "rgba(28, 27, 31, 1)", | ||
"writingDirection": "ltr", | ||
}, | ||
[ | ||
{ | ||
"fontFamily": "System", | ||
"fontSize": 14, | ||
"fontWeight": "500", | ||
"letterSpacing": 0.1, | ||
"lineHeight": 20, | ||
}, | ||
[ | ||
{ | ||
"marginHorizontal": 16, | ||
"marginVertical": 9, | ||
"textAlign": "center", | ||
}, | ||
false, | ||
{ | ||
"marginHorizontal": 12, | ||
}, | ||
undefined, | ||
false, | ||
{ | ||
"color": "rgba(103, 80, 164, 1)", | ||
"fontFamily": "System", | ||
"fontSize": 14, | ||
"fontWeight": "500", | ||
"letterSpacing": 0.1, | ||
"lineHeight": 20, | ||
}, | ||
undefined, | ||
], | ||
], | ||
] | ||
} | ||
testID="button-text" | ||
> | ||
open_project_page | ||
</Text> | ||
</View> | ||
</View> | ||
</View> | ||
</View> | ||
<Text | ||
style={ | ||
[ | ||
{ | ||
"textAlign": "left", | ||
}, | ||
{ | ||
"color": "rgba(28, 27, 31, 1)", | ||
"fontFamily": "System", | ||
"fontWeight": "400", | ||
"letterSpacing": 0, | ||
}, | ||
{ | ||
"writingDirection": "ltr", | ||
}, | ||
undefined, | ||
] | ||
} | ||
> | ||
app_version | ||
: | ||
1.0 (beta) | ||
</Text> | ||
</View> | ||
</RCTScrollView> | ||
`; |
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
Oops, something went wrong.