-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(app): allow app update pop-up notifications to be disabled
Closes #6684
- Loading branch information
Showing
24 changed files
with
654 additions
and
112 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,52 @@ | ||
// @flow | ||
import * as Config from '../../config' | ||
import * as Actions from '../actions' | ||
|
||
import type { AlertId, AlertsAction } from '../types' | ||
import type { AlertId } from '../types' | ||
|
||
const MOCK_ALERT_ID: AlertId = ('mockAlert': any) | ||
|
||
type ActionSpec = {| | ||
should: string, | ||
creator: (...args: Array<any>) => AlertsAction, | ||
args: Array<mixed>, | ||
expected: AlertsAction, | ||
|} | ||
|
||
const SPECS: Array<ActionSpec> = [ | ||
{ | ||
should: 'allow an alert to be triggered', | ||
creator: Actions.alertTriggered, | ||
args: [MOCK_ALERT_ID], | ||
expected: { | ||
describe('alerts actions', () => { | ||
it('should allow an alert to be triggered', () => { | ||
const result = Actions.alertTriggered(MOCK_ALERT_ID) | ||
|
||
expect(result).toEqual({ | ||
type: 'alerts:ALERT_TRIGGERED', | ||
payload: { alertId: MOCK_ALERT_ID }, | ||
}, | ||
}, | ||
{ | ||
should: 'allow an alert to be dismissed temporarily', | ||
creator: Actions.alertDismissed, | ||
args: [MOCK_ALERT_ID], | ||
expected: { | ||
}) | ||
}) | ||
|
||
it('should allow an alert to be dismissed temporarily', () => { | ||
const result = Actions.alertDismissed(MOCK_ALERT_ID) | ||
|
||
expect(result).toEqual({ | ||
type: 'alerts:ALERT_DISMISSED', | ||
payload: { alertId: MOCK_ALERT_ID, remember: false }, | ||
}, | ||
}, | ||
{ | ||
should: 'allow an alert to be dismissed permanently', | ||
creator: Actions.alertDismissed, | ||
args: [MOCK_ALERT_ID, true], | ||
expected: { | ||
}) | ||
}) | ||
|
||
it('should allow an alert to be dismissed permanently', () => { | ||
const result = Actions.alertDismissed(MOCK_ALERT_ID, true) | ||
|
||
expect(result).toEqual({ | ||
type: 'alerts:ALERT_DISMISSED', | ||
payload: { alertId: MOCK_ALERT_ID, remember: true }, | ||
}, | ||
}, | ||
] | ||
|
||
describe('alerts actions', () => { | ||
SPECS.forEach(({ should, creator, args, expected }) => { | ||
it(`should ${should}`, () => { | ||
expect(creator).toEqual(expect.any(Function)) | ||
expect(creator(...args)).toEqual(expected) | ||
}) | ||
}) | ||
|
||
it('should allow an alert to be ignored permanently', () => { | ||
const result = Actions.alertPermanentlyIgnored(MOCK_ALERT_ID) | ||
|
||
expect(result).toEqual( | ||
Config.addUniqueConfigValue('alerts.ignored', MOCK_ALERT_ID) | ||
) | ||
}) | ||
|
||
it('should allow an alert to be unignored', () => { | ||
const result = Actions.alertUnignored(MOCK_ALERT_ID) | ||
|
||
expect(result).toEqual( | ||
Config.subtractConfigValue('alerts.ignored', MOCK_ALERT_ID) | ||
) | ||
}) | ||
}) |
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
Oops, something went wrong.