-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Major release
- Loading branch information
Showing
50 changed files
with
1,174 additions
and
701 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,6 @@ node_modules | |
.DS_Store | ||
lib | ||
coverage | ||
yarn-error.log | ||
yarn-error.log | ||
.clinic | ||
examples/music/.test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Station } from '../../index'; | ||
|
||
describe('public/FailPaths/common', () => { | ||
it('non-existing folder - throws error', () => { | ||
const station = new Station(); | ||
expect(() => { | ||
station.addFolder('biba'); // non-existing | ||
}).toThrow(); | ||
}); | ||
|
||
it.todo('track was deleted while playback - revalidates folders'); | ||
it.todo('track has some problems while reading - skip it'); | ||
it.todo('track has some problems on stream - skip it'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { Station, PUBLIC_EVENTS } from '../../index'; | ||
import { pathToMusic } from '../test-utils.mock'; | ||
|
||
const createChecker = () => ({ | ||
start: jest.fn(), | ||
nextTrack: jest.fn(), | ||
restart: jest.fn(), | ||
error: jest.fn(), | ||
}); | ||
|
||
describe('public/HappyPath/events', () => { | ||
it('station events - fires', () => { | ||
const checker = createChecker(); | ||
const station = new Station(); | ||
|
||
station.on(PUBLIC_EVENTS.START, (...args) => checker.start(...args)); | ||
station.on(PUBLIC_EVENTS.NEXT_TRACK, (...args) => checker.nextTrack(...args)); | ||
station.on(PUBLIC_EVENTS.RESTART, (...args) => checker.restart(...args)); | ||
station.on(PUBLIC_EVENTS.ERROR, (...args) => checker.error(...args)); | ||
|
||
station.addFolder(pathToMusic); | ||
|
||
// event "start" | ||
station.start(); | ||
|
||
expect(checker.start).toHaveBeenCalledTimes(1); | ||
// start event fired | ||
expect(checker.start.mock.calls[0][0]).toEqual(station.getPlaylist()); | ||
// expect(checker.start).toHaveBeenCalledWith(station.getPlaylist()); | ||
// nextTrack event fired | ||
expect(checker.nextTrack.mock.calls[0][0]).toEqual(station.getPlaylist()[0]); | ||
|
||
// event "nextTrack" | ||
station.next(); | ||
// nextTrack returns a track | ||
expect(checker.nextTrack.mock.calls[1][0]).toEqual(station.getPlaylist()[1]); | ||
|
||
// event "restart" | ||
station.next(); | ||
|
||
// returns playlist | ||
expect(checker.restart.mock.calls[0][0].map((v) => v.fsStats)) | ||
.toEqual(station.getPlaylist().map((v) => v.fsStats)); | ||
|
||
// @TODO find some way to test error event | ||
}); | ||
}); |
Oops, something went wrong.