Consecutive playback and per-conversation playback rate
This commit is contained in:
parent
eb10aafd7c
commit
6cfe2a09df
20 changed files with 783 additions and 319 deletions
|
@ -1,31 +1,42 @@
|
|||
// Copyright 2021 Signal Messenger, LLC
|
||||
// Copyright 2021-2022 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { assert } from 'chai';
|
||||
import { actions } from '../../../state/ducks/audioPlayer';
|
||||
import type { SetMessageAudioAction } from '../../../state/ducks/audioPlayer';
|
||||
import { noopAction } from '../../../state/ducks/noop';
|
||||
import { isPaused } from '../../../state/selectors/audioPlayer';
|
||||
import type { StateType } from '../../../state/reducer';
|
||||
import { reducer as rootReducer } from '../../../state/reducer';
|
||||
|
||||
// can't use the actual action since it's a ThunkAction
|
||||
const setActiveAudioID = (
|
||||
id: string,
|
||||
context: string
|
||||
): SetMessageAudioAction => ({
|
||||
type: 'audioPlayer/SET_MESSAGE_AUDIO',
|
||||
payload: {
|
||||
id,
|
||||
context,
|
||||
playbackRate: 1,
|
||||
duration: 100,
|
||||
},
|
||||
});
|
||||
|
||||
describe('state/selectors/audioPlayer', () => {
|
||||
const getEmptyRootState = (): StateType => {
|
||||
return rootReducer(undefined, noopAction());
|
||||
};
|
||||
|
||||
describe('isPaused', () => {
|
||||
it('returns true if state.audioPlayer.activeAudioID is undefined', () => {
|
||||
it('returns true if state.audioPlayer.active is undefined', () => {
|
||||
const state = getEmptyRootState();
|
||||
assert.isTrue(isPaused(state));
|
||||
});
|
||||
|
||||
it('returns false if state.audioPlayer.activeAudioID is not undefined', () => {
|
||||
it('returns false if state.audioPlayer.active is not undefined', () => {
|
||||
const state = getEmptyRootState();
|
||||
|
||||
const updated = rootReducer(
|
||||
state,
|
||||
actions.setActiveAudioID('id', 'context')
|
||||
);
|
||||
const updated = rootReducer(state, setActiveAudioID('id', 'context'));
|
||||
|
||||
assert.isFalse(isPaused(updated));
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue