andrehaveman / spotify-node-applescript

Control Spotify on Mac OSX with NodeJS and AppleScript
MIT License
316 stars 38 forks source link

feat: Add seekForward and seekBackward #49

Open dyong1 opened 3 years ago

dyong1 commented 3 years ago

Hi, thank you for running this awesome project. I'm opening this PR to add seeking capability for extending vscode-spotify.

You can find the main changes in 14d3e45. The others are just formatting and fixing the original tests. I hope you like this PR and let it merged soon.

Regarding the quality of this PR, you can check the tests written in the commit above. Also, I've run the test suite +10 times on my local as followed by:

❯ yarn test                       
yarn run v1.22.10
$ mocha

  Spotify Controller
    ✓ play track (894ms)
    ✓ should pause a track (357ms)
    ✓ should resume playing a track after pausing (497ms)
    ✓ should play and pause a track (611ms)
    ✓ should return playing track (196ms)
    ✓ should jump to a specific position of the song (1401ms)
    ✓ play next track (325ms)
    ✓ play previous track (477ms)
    ✓ should turn volume up (611ms)
    ✓ should turn volume down (610ms)
    ✓ should not overflow on volume up (600ms)
    ✓ should not overflow on volume down (671ms)
    ✓ should set the volume (305ms)
    ✓ should mute and unmute the volume (950ms)
    ✓ should seek forward (694ms)
    ✓ should seek backward (541ms)
    ✓ should set position to 0 on seeking foward exceeding max (607ms)
    ✓ should set position to 0 on seeking foward exceeding min (661ms)
    ✓ should return current track (192ms)
    ✓ should return player status (166ms)
    ✓ should return true when spotify is running (82ms)
    ✓ should set the repeating to false (346ms)
    ✓ should set the repeating to true (298ms)
    ✓ should set the shuffling to false (299ms)
    ✓ should set the shuffling to true (353ms)
    ✓ should toggle the repeating (487ms)
    ✓ should toggle the shuffling (450ms)

  27 passing (18s)

✨  Done in 18.34s.