marionebl/jogwheel

View on GitHub
source/test/unit/stubs/player.js

Summary

Maintainability
A
1 hr
Test Coverage
const playerStub = options => {
    const _state = {
        currentTime: 0,
        activeDuration: 0,
        playState: 'running'
    };

    _state.activeDuration = options.duration;

    return {
        play() {
            _state.playState = 'running';
        },
        pause() {
            _state.playState = 'paused';
        },
        cancel() {
            _state.playState = 'canceled';
        },
        effect: {
            get currentTime() {
                return _state.currentTime;
            },
            get activeDuration() {
                return _state.activeDuration;
            }
        },
        get playState() {
            return _state.playState;
        }
    };
};

export default playerStub;