1
0
mirror of https://gitlab.com/Emeraude/music-very-player.git synced 2024-11-23 19:31:21 +01:00
music-very-player/test/playlist.test.js
2021-01-28 01:04:30 +01:00

21 lines
613 B
JavaScript

const { Playlist } = require('../src/playlist');
describe('playlist basic manipulations', () => {
const p1 = new Playlist();
test('initial state', () => {
expect(p1.get_current_track()).toBeNull()
})
test('add new track', () => {
expect(p1.push("track1")).toBeTruthy()
expect(p1.get_current_track()).toEqual("track1")
})
test('remove inexisting track', () => {
expect(p1.delete(100)).toBeFalsy()
expect(p1.get_current_track()).toEqual("track1")
})
test('remove existing track', () => {
expect(p1.delete(0)).toBeTruthy()
expect(p1.get_current_track()).toNull()
})
})