Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.54 KB | None | 0 0
  1. describe('SoftUniFy', function () {
  2.  
  3. it("Initialize an empty instance", () => {
  4. const softUniFy = new SoftUniFy('');
  5. const actual = {};
  6. expect(softUniFy.allSongs).to.be.deep.equal(actual);
  7. });
  8. it("Checking the functionality - 1", () => {
  9. const softUniFy = new SoftUniFy();
  10. expect(softUniFy).to.be.have.property("downloadSong");
  11. expect(softUniFy).to.be.have.property("playSong");
  12. expect(softUniFy).to.be.have.property("rateArtist");
  13. });
  14. it("downloadSong - 1", () => {
  15. const softUniFy = new SoftUniFy('');
  16. const expected = softUniFy.downloadSong('Eminem', 'Phenomenal', 'IM PHENOMENAL...');
  17. expect(expected.allSongs).to.be.deep.equal({
  18. Eminem: {
  19. rate: 0,
  20. votes: 0,
  21. songs: ['Phenomenal - IM PHENOMENAL...']
  22. }
  23. });
  24. });
  25. it("downloadSong - 2", () => {
  26. const softUniFy = new SoftUniFy('');
  27. const expected1 = softUniFy.downloadSong('Eminem', 'Venom', 'Knock, Knock let the devil in...');
  28. const expected2 = softUniFy.downloadSong('Eminem', 'Phenomenal', 'IM PHENOMENAL...');
  29. expect(softUniFy.allSongs).to.be.deep.equal({
  30. Eminem: {
  31. rate: 0,
  32. votes: 0,
  33. songs: [
  34. 'Venom - Knock, Knock let the devil in...',
  35. 'Phenomenal - IM PHENOMENAL...'
  36. ]
  37. }
  38. });
  39. });
  40. it("playSong - 1. Should return an error", () => {
  41. const softUniFy = new SoftUniFy();
  42. const expected = softUniFy.playSong("something");
  43. expect(() => expected.to.be.equal("`You have not downloaded a something song yet. Use SoftUniFy's function downloadSong() to change that!"));
  44. });
  45. it("playSong - 2. Should play the song", () => {
  46. const softUniFy = new SoftUniFy();
  47. const down = softUniFy.downloadSong('Eminem', 'Phenomenal', 'IM PHENOMENAL...');
  48. const expected = softUniFy.playSong("Phenomenal");
  49. expect(expected).to.be.deep.equal('Eminem:\nPhenomenal - IM PHENOMENAL...\n');
  50. });
  51. it("songList - 1. Should show the songs", () => {
  52. const softUniFy = new SoftUniFy();
  53. const down = softUniFy.downloadSong('Eminem', 'Venom', 'Knock, Knock let the devil');
  54. const expected = down.songsList;
  55. expect(expected).to.be.equal("Venom - Knock, Knock let the devil");
  56. });
  57. it("songList - 2. Should trow error", () => {
  58. const softUniFy = new SoftUniFy();
  59. const expected = softUniFy.songsList;
  60. expect(expected).to.be.equal('Your song list is empty');
  61. });
  62. it("rateArtist - 1. Should return error", () => {
  63. const softUniFy = new SoftUniFy();
  64. const expected = softUniFy.rateArtist("Monika");
  65. expect(() => expected.to.be.deep.equal('The Monika is not on your artist list.'));
  66. });
  67. it("rateArtist - 2. Should return 0", () => {
  68. const softUniFy = new SoftUniFy();
  69. const down = softUniFy.downloadSong('Eminem', 'Venom', 'Knock, Knock let the devil in...');
  70. const expected = softUniFy.rateArtist("Eminem");
  71. expect(expected).to.be.deep.equal(0);
  72. });
  73. it("rateArtist - 3. Should return 5", () => {
  74. const softUniFy = new SoftUniFy();
  75. const down = softUniFy.downloadSong('Eminem', 'Venom', 'Knock, Knock let the devil in...');
  76. const expected = softUniFy.rateArtist("Eminem", 5);
  77. expect(expected).to.be.deep.equal(5);
  78. });
  79. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement