2021-03-10 20:36:58 +00:00
|
|
|
// 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 { StateType, reducer as rootReducer } from '../../../state/reducer';
|
|
|
|
|
2021-03-24 23:08:44 +00:00
|
|
|
describe('both/state/ducks/audioPlayer', () => {
|
2021-03-10 20:36:58 +00:00
|
|
|
const getEmptyRootState = (): StateType => {
|
|
|
|
return rootReducer(undefined, noopAction());
|
|
|
|
};
|
|
|
|
|
2021-03-24 23:08:44 +00:00
|
|
|
describe('setActiveAudioID', () => {
|
2021-03-10 20:36:58 +00:00
|
|
|
it("updates `activeAudioID` in the audioPlayer's state", () => {
|
|
|
|
const state = getEmptyRootState();
|
|
|
|
assert.strictEqual(state.audioPlayer.activeAudioID, undefined);
|
|
|
|
|
|
|
|
const updated = rootReducer(state, actions.setActiveAudioID('test'));
|
|
|
|
assert.strictEqual(updated.audioPlayer.activeAudioID, 'test');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|