Unify audio playback under App component
This commit is contained in:
parent
8b30fc17cd
commit
2cd4160422
19 changed files with 290 additions and 80 deletions
32
ts/test-electron/state/selectors/audioPlayer_test.ts
Normal file
32
ts/test-electron/state/selectors/audioPlayer_test.ts
Normal file
|
@ -0,0 +1,32 @@
|
|||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { assert } from 'chai';
|
||||
import { actions } from '../../../state/ducks/audioPlayer';
|
||||
import { noopAction } from '../../../state/ducks/noop';
|
||||
import { isPaused } from '../../../state/selectors/audioPlayer';
|
||||
import { StateType, reducer as rootReducer } from '../../../state/reducer';
|
||||
|
||||
describe('state/selectors/audioPlayer', () => {
|
||||
const getEmptyRootState = (): StateType => {
|
||||
return rootReducer(undefined, noopAction());
|
||||
};
|
||||
|
||||
describe('isPaused', () => {
|
||||
it('returns true if state.audioPlayer.activeAudioID is undefined', () => {
|
||||
const state = getEmptyRootState();
|
||||
assert.isTrue(isPaused(state));
|
||||
});
|
||||
|
||||
it('returns false if state.audioPlayer.activeAudioID is not undefined', () => {
|
||||
const state = getEmptyRootState();
|
||||
|
||||
const updated = rootReducer(
|
||||
state,
|
||||
actions.setActiveAudioID('id', 'context')
|
||||
);
|
||||
|
||||
assert.isFalse(isPaused(updated));
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue