Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const expect = require("chai").expect;
- const SoftUniFy = require("../sorceCode").SoftUniFy;
- describe("SoftUniFly tests", function () {
- describe("Constructor tests", function () {
- it("Should be initialized correctly", function() {
- const fly = new SoftUniFy();
- expect(fly.allSongs).to.be.eql({});
- expect(Object.keys(fly.allSongs).length).to.be.equal(0);
- expect(fly.allSongs.toString()).to.be.equal('[object Object]');
- expect(fly.songsList).to.be.equal('Your song list is empty');
- });
- })
- describe("DownloadSong", function () {
- it("Should be tested", function() {
- const fly = new SoftUniFy();
- fly.downloadSong('Test', 'TestSong', 'TestLirics');
- expect(fly.songsList).to.be.equal('TestSong - TestLirics');
- expect(Object.keys(fly.allSongs).length).to.be.equal(1);
- });
- })
- describe("PlaySong", function () {
- it("Should be tested playing", function() {
- const fly = new SoftUniFy();
- fly.downloadSong('Test', 'TestSong', 'TestLirics');
- fly.downloadSong('Test1', 'TestSong1', 'TestLirics1');
- expect(fly.songsList).to.be.equal('TestSong - TestLirics\nTestSong1 - TestLirics1');
- expect(Object.keys(fly.allSongs).length).to.be.equal(2);
- expect(fly.playSong('TestSong')).to.be.equal('Test:\nTestSong - TestLirics\n');
- });
- it("Should be tested empty playing", function() {
- const fly = new SoftUniFy();
- expect(fly.playSong('TestSong')).to.be.equal(`You have not downloaded a TestSong song yet. Use SoftUniFy's function downloadSong() to change that!`);
- });
- })
- describe("Rate artist", function () {
- it("Should be tested rating", function() {
- const fly = new SoftUniFy();
- fly.downloadSong('Test', 'TestSong', 'TestLirics');
- fly.downloadSong('Test1', 'TestSong1', 'TestLirics1');
- fly.rateArtist('Test', 50);
- expect(fly.rateArtist('Test')).to.be.equal(50);
- });
- })
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement