forked from turingschool-examples/javascript-foundations
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdj-test.js
More file actions
95 lines (66 loc) · 3.98 KB
/
dj-test.js
File metadata and controls
95 lines (66 loc) · 3.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
var { createSong, playSong, makePlaylist, addSongToPlaylist, playSongs, playFavorites } = require('./dj');
var assert = require('chai').assert;
describe('dj', function() {
it.skip('should be able to create songs', function() {
var song = createSong('Zombie Shuffle', 'The Creepy Crawlers', true)
assert.equal(song.name, 'Zombie Shuffle');
assert.equal(song.artist, 'The Creepy Crawlers');
assert.equal(song.favorite, true);
})
it.skip('should not have been played by default', function() {
var song = createSong('Witches\' Brew Boogie', 'The Ghostly Ghouls', true)
assert.equal(song.name, 'Witches\' Brew Boogie');
assert.equal(song.artist, 'The Ghostly Ghouls');
assert.equal(song.favorite, true);
assert.equal(song.hasBeenPlayed, false);
})
it.skip('should not be a favorite by default', function() {
var song = createSong('Witches\' Brew Boogie', 'The Ghostly Ghouls')
assert.equal(song.favorite, false);
})
it.skip('should be able to play a song', function() {
var song = createSong('I Put A Spell On You', 'Bette Midler, Sarah Jessica Parker & Kathy Najimy')
assert.equal(song.name, 'I Put A Spell On You');
assert.equal(song.artist, 'Bette Midler, Sarah Jessica Parker & Kathy Najimy');
assert.equal(song.hasBeenPlayed, false);
assert.equal(song.favorite, false);
var playedSong = playSong(song)
assert.equal(playedSong.hasBeenPlayed, true);
})
it.skip('should be able to create a playlist', function() {
var skeletonSong = createSong('Skeletons in the Closet Rock', 'The Skeletal Band');
var tangoTrack = createSong('Trick or Treat Tango', 'The Spooky Cats');
var playlist = makePlaylist('Halloween Songs', [skeletonSong, tangoTrack]);
assert.equal(playlist.name, 'Halloween Songs');
assert.deepEqual(playlist.songs, [skeletonSong, tangoTrack])
})
it.skip('should be able to add songs to a playlist', function() {
var jingleJive = createSong('Jingle Bell Jive', 'The Dancing Elves');
var holidayPlaylist = makePlaylist('Holiday Songs', [jingleJive]);
assert.equal(holidayPlaylist.name, 'Holiday Songs');
assert.deepEqual(holidayPlaylist.songs, [jingleJive])
var funkyFrosty = createSong('Frosty\'s Funky Groove', 'The Snowmen Band');
var updatedHolidayPlaylist = addSongToPlaylist(holidayPlaylist, funkyFrosty);
assert.deepEqual(updatedHolidayPlaylist.songs, [jingleJive, funkyFrosty])
})
it.skip('should be able to play all the songs', function() {
var rockinSong = createSong('Rockin\' Around the Christmas Treehouse', 'The Yuletide Youth');
var shuffleSong = createSong('Santa\'s Sleigh Ride Shuffle', 'The Jolly Jinglesters')
var reggaeSong = createSong('Rudolph\'s Reggae Jam', 'The Reindeer Rhythms')
var holidayPlaylist = makePlaylist('Holiday Songs', [rockinSong, shuffleSong, reggaeSong]);
var updatedHolidayPlaylist = playSongs(holidayPlaylist)
assert.equal(updatedHolidayPlaylist.songs[0].hasBeenPlayed, true)
assert.equal(updatedHolidayPlaylist.songs[1].hasBeenPlayed, true)
assert.equal(updatedHolidayPlaylist.songs[2].hasBeenPlayed, true)
})
it.skip('should be able to play only the favorites if specified', function() {
var rockinSong = createSong('Rockin\' Around the Christmas Treehouse', 'The Yuletide Youth', true);
var shuffleSong = createSong('Santa\'s Sleigh Ride Shuffle', 'The Jolly Jinglesters')
var reggaeSong = createSong('Rudolph\'s Reggae Jam', 'The Reindeer Rhythms', true)
var holidayPlaylist = makePlaylist('Holiday Songs', [rockinSong, shuffleSong, reggaeSong]);
var updatedHolidayPlaylist = playSongs(holidayPlaylist, "favorites only")
assert.equal(updatedHolidayPlaylist.songs[0].hasBeenPlayed, true)
assert.equal(updatedHolidayPlaylist.songs[1].hasBeenPlayed, false)
assert.equal(updatedHolidayPlaylist.songs[2].hasBeenPlayed, true)
})
})