Advertisement
Danny_Berova

2.SoftUniFly

Nov 19th, 2018
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. const expect = require("chai").expect;
  2. const SoftUniFy = require("../sorceCode").SoftUniFy;
  3.  
  4. describe("SoftUniFly tests", function () {
  5.  
  6. describe("Constructor tests", function () {
  7. it("Should be initialized correctly", function() {
  8. const fly = new SoftUniFy();
  9. expect(fly.allSongs).to.be.eql({});
  10. expect(Object.keys(fly.allSongs).length).to.be.equal(0);
  11. expect(fly.allSongs.toString()).to.be.equal('[object Object]');
  12. expect(fly.songsList).to.be.equal('Your song list is empty');
  13. });
  14. })
  15. describe("DownloadSong", function () {
  16. it("Should be tested", function() {
  17. const fly = new SoftUniFy();
  18. fly.downloadSong('Test', 'TestSong', 'TestLirics');
  19. expect(fly.songsList).to.be.equal('TestSong - TestLirics');
  20. expect(Object.keys(fly.allSongs).length).to.be.equal(1);
  21. });
  22. })
  23. describe("PlaySong", function () {
  24. it("Should be tested playing", function() {
  25. const fly = new SoftUniFy();
  26. fly.downloadSong('Test', 'TestSong', 'TestLirics');
  27. fly.downloadSong('Test1', 'TestSong1', 'TestLirics1');
  28. expect(fly.songsList).to.be.equal('TestSong - TestLirics\nTestSong1 - TestLirics1');
  29. expect(Object.keys(fly.allSongs).length).to.be.equal(2);
  30. expect(fly.playSong('TestSong')).to.be.equal('Test:\nTestSong - TestLirics\n');
  31. });
  32. it("Should be tested empty playing", function() {
  33. const fly = new SoftUniFy();
  34. expect(fly.playSong('TestSong')).to.be.equal(`You have not downloaded a TestSong song yet. Use SoftUniFy's function downloadSong() to change that!`);
  35. });
  36. })
  37. describe("Rate artist", function () {
  38. it("Should be tested rating", function() {
  39. const fly = new SoftUniFy();
  40. fly.downloadSong('Test', 'TestSong', 'TestLirics');
  41. fly.downloadSong('Test1', 'TestSong1', 'TestLirics1');
  42. fly.rateArtist('Test', 50);
  43. expect(fly.rateArtist('Test')).to.be.equal(50);
  44. });
  45. })
  46. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement