Advertisement
ilianrusev

Untitled

Feb 19th, 2022
38
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const { expect } = require('chai')
  2. const ChristmasMovies = require('./02. Christmas Movies_Resources')
  3.  
  4. describe("test", () => {
  5.  
  6. let instance = {}
  7. beforeEach(() =>instance = new ChristmasMovies({
  8. movieCollection: [],
  9. watched: {},
  10. actors: []
  11. }))
  12.  
  13. describe("buyMovie method", () => {
  14.  
  15. it("should add", () => {
  16. expect(instance.buyMovie("pirates", ["ac1", "ac2", "ac3"])).to.be.equal("You just got pirates to your collection in which ac1, ac2, ac3 are taking part!")
  17. })
  18. it("its there", () => {
  19. instance.buyMovie('Last Christmas', ['Madison Ingoldsby', 'Emma Thompson', 'Boris Isakovic', 'Madison Ingoldsby'])
  20. expect(() => instance.buyMovie('Last Christmas', ["ac1", "ac2", "ac3"])).to.throw(`You already own Last Christmas in your collection!`)
  21. })
  22. })
  23.  
  24. describe("discardMovie method", () => {
  25.  
  26. it("wont delete", () => {
  27. instance.buyMovie('Last Christmas 2', ['Madison Ingoldsby', 'Emma Thompson', 'Boris Isakovic', 'Madison Ingoldsby'])
  28. expect(() => instance.discardMovie('pirates')).to.throw(`pirates is not at your collection!`)
  29. })
  30. it("not watched", () => {
  31. instance.buyMovie('Last Christmas', ['Madison Ingoldsby', 'Emma Thompson', 'Boris Isakovic', 'Madison Ingoldsby'])
  32. expect(() => instance.discardMovie('Last Christmas')).to.throw(`Last Christmas is not watched!`)
  33. })
  34. it("watched", () => {
  35. instance.buyMovie('pirate', ['Madison Ingoldsby', 'Emma Thompson', 'Boris Isakovic', 'Madison Ingoldsby'])
  36. instance.watchMovie("pirate")
  37. expect(instance.discardMovie('pirate')).to.be.equal(`You just threw away pirate!`)
  38. })
  39. })
  40.  
  41. describe("watchMovie method", () => {
  42. it("not in collection", () => {
  43.  
  44. expect(() => instance.watchMovie("pirate")).to.throw("No such movie in your collection!")
  45. })
  46. })
  47.  
  48. describe("favouriteMovie method", () => {
  49.  
  50. it("no watched", () => {
  51. expect(() => instance.favouriteMovie()).to.throw("You have not watched a movie yet this year!")
  52. })
  53. it("favourite", () => {
  54. instance.buyMovie('Last Christmas', ['Madison Ingoldsby', 'Emma Thompson', 'Boris Isakovic', 'Madison Ingoldsby'])
  55. instance.buyMovie('pirate', ['Madison Ingoldsby', 'Emma Thompson', 'Boris Isakovic', 'Madison Ingoldsby'])
  56. instance.watchMovie("pirate")
  57. instance.watchMovie("pirate")
  58. instance.watchMovie("Last Christmas")
  59. expect(instance.favouriteMovie()).to.equal("Your favourite movie is pirate and you have watched it 2 times!")
  60. })
  61. })
  62.  
  63. describe("mostStarredActors method", () => {
  64.  
  65. it("no movies", () => {
  66. expect(() => instance.mostStarredActor()).to.throw("You have not watched a movie yet this year!")
  67. })
  68. it("successfuly", () => {
  69.  
  70. instance.buyMovie('Last Christmas', ['Madison Ingoldsby', 'Emma Thompson', 'Boris Isakovic', 'Madison Ingoldsby'])
  71. instance.buyMovie('pirate', ['Madison Ingoldsby'])
  72.  
  73. expect(instance.mostStarredActor()).to.equal("The most starred actor is Madison Ingoldsby and starred in 2 movies!")
  74. })
  75. })
  76. })
Advertisement
RAW Paste Data Copied
Advertisement