Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- describe('SoftUniFy', function () {
- it("Initialize an empty instance", () => {
- const softUniFy = new SoftUniFy('');
- const actual = {};
- expect(softUniFy.allSongs).to.be.deep.equal(actual);
- });
- it("Checking the functionality - 1", () => {
- const softUniFy = new SoftUniFy();
- expect(softUniFy).to.be.have.property("downloadSong");
- expect(softUniFy).to.be.have.property("playSong");
- expect(softUniFy).to.be.have.property("rateArtist");
- });
- it("downloadSong - 1", () => {
- const softUniFy = new SoftUniFy('');
- const expected = softUniFy.downloadSong('Eminem', 'Phenomenal', 'IM PHENOMENAL...');
- expect(expected.allSongs).to.be.deep.equal({
- Eminem: {
- rate: 0,
- votes: 0,
- songs: ['Phenomenal - IM PHENOMENAL...']
- }
- });
- });
- it("downloadSong - 2", () => {
- const softUniFy = new SoftUniFy('');
- const expected1 = softUniFy.downloadSong('Eminem', 'Venom', 'Knock, Knock let the devil in...');
- const expected2 = softUniFy.downloadSong('Eminem', 'Phenomenal', 'IM PHENOMENAL...');
- expect(softUniFy.allSongs).to.be.deep.equal({
- Eminem: {
- rate: 0,
- votes: 0,
- songs: [
- 'Venom - Knock, Knock let the devil in...',
- 'Phenomenal - IM PHENOMENAL...'
- ]
- }
- });
- });
- it("playSong - 1. Should return an error", () => {
- const softUniFy = new SoftUniFy();
- const expected = softUniFy.playSong("something");
- expect(() => expected.to.be.equal("`You have not downloaded a something song yet. Use SoftUniFy's function downloadSong() to change that!"));
- });
- it("playSong - 2. Should play the song", () => {
- const softUniFy = new SoftUniFy();
- const down = softUniFy.downloadSong('Eminem', 'Phenomenal', 'IM PHENOMENAL...');
- const expected = softUniFy.playSong("Phenomenal");
- expect(expected).to.be.deep.equal('Eminem:\nPhenomenal - IM PHENOMENAL...\n');
- });
- it("songList - 1. Should show the songs", () => {
- const softUniFy = new SoftUniFy();
- const down = softUniFy.downloadSong('Eminem', 'Venom', 'Knock, Knock let the devil');
- const expected = down.songsList;
- expect(expected).to.be.equal("Venom - Knock, Knock let the devil");
- });
- it("songList - 2. Should trow error", () => {
- const softUniFy = new SoftUniFy();
- const expected = softUniFy.songsList;
- expect(expected).to.be.equal('Your song list is empty');
- });
- it("rateArtist - 1. Should return error", () => {
- const softUniFy = new SoftUniFy();
- const expected = softUniFy.rateArtist("Monika");
- expect(() => expected.to.be.deep.equal('The Monika is not on your artist list.'));
- });
- it("rateArtist - 2. Should return 0", () => {
- const softUniFy = new SoftUniFy();
- const down = softUniFy.downloadSong('Eminem', 'Venom', 'Knock, Knock let the devil in...');
- const expected = softUniFy.rateArtist("Eminem");
- expect(expected).to.be.deep.equal(0);
- });
- it("rateArtist - 3. Should return 5", () => {
- const softUniFy = new SoftUniFy();
- const down = softUniFy.downloadSong('Eminem', 'Venom', 'Knock, Knock let the devil in...');
- const expected = softUniFy.rateArtist("Eminem", 5);
- expect(expected).to.be.deep.equal(5);
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement