Advertisement
Liliana797979

3_cinema - js advanced exam

Oct 15th, 2021
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. describe("Tests …", function() {
  2.     describe("showMovies", function() {
  3.         it("empty array", function() {
  4.             expect(cinema.showMovies([])).to.be.equal("There are currently no movies to show.")
  5.         });
  6.  
  7.         it("array of movies", function() {
  8.             expect(cinema.showMovies(["King Kong", "The Tomorrow War", "Joker"])).to.be.equal("King Kong, The Tomorrow War, Joker");
  9.         })
  10.  
  11.         it( "array of single movie", function() {
  12.             expect(cinema.showMovies(["King Kong"])).to.be.equal("King Kong");
  13.         })
  14.     });
  15.  
  16.     describe("ticketPrice", function() {
  17.         it ("Premiere price", function() {
  18.             expect(cinema.ticketPrice("Premiere")).to.be.equal(12.00);
  19.         })
  20.  
  21.         it ("Normal price", function() {
  22.             expect(cinema.ticketPrice("Normal")).to.be.equal(7.50);
  23.         })
  24.  
  25.         it ("Discount price", function () {
  26.             expect(cinema.ticketPrice("Discount")).to.be.equal(5.50);
  27.         })
  28.  
  29.         it ("Invalid input", function() {
  30.             expect(() => cinema.ticketPrice("Invalid")).to.throw("Invalid projection type.");
  31.         })
  32.  
  33.         it ("Invalid input", function() {
  34.             expect(() => cinema.ticketPrice("")).to.throw("Invalid projection type.");
  35.         })
  36.     });
  37.     describe("swapSeatsInHall", function() {
  38.         it("only 1 param given", function() {
  39.             expect(cinema.swapSeatsInHall(1)).to.be.equal("Unsuccessful change of seats in the hall.");
  40.         });
  41.  
  42.         it("floating number given", function() {
  43.             expect(cinema.swapSeatsInHall(1.25,5)).to.be.equal("Unsuccessful change of seats in the hall.");
  44.         })
  45.  
  46.         it("greater than 20 number given", function() {
  47.             expect(cinema.swapSeatsInHall(25, 5)).to.be.equal("Unsuccessful change of seats in the hall.");
  48.         })
  49.  
  50.         it("negative number given", function() {
  51.             expect(cinema.swapSeatsInHall(-5, 5)).to.be.equal("Unsuccessful change of seats in the hall.");
  52.         })
  53.  
  54.         it("0 given as number", function() {
  55.             expect(cinema.swapSeatsInHall(0, 5)).to.be.equal("Unsuccessful change of seats in the hall.");
  56.         })
  57.  
  58.         it ("equal numbers", function() {
  59.             expect(cinema.swapSeatsInHall(5, 5)).to.be.equal("Unsuccessful change of seats in the hall.");
  60.         })
  61.  
  62.  
  63.         it("normal expected output", function() {
  64.             expect(cinema.swapSeatsInHall(5, 10)).to.be.equal("Successful change of seats in the hall.");
  65.         })
  66.  
  67.  
  68.         it("1 and 2 numbers given", function() {
  69.             expect(cinema.swapSeatsInHall(1, 20)).to.be.equal("Successful change of seats in the hall.");
  70.         })
  71.  
  72.         it ("both numbers out of range", function() {
  73.             expect(cinema.swapSeatsInHall(25, 26)).to.be.equal("Unsuccessful change of seats in the hall.");
  74.         })
  75.  
  76.         it ("invalid param type", function() {
  77.             expect(cinema.swapSeatsInHall("movie", null)).to.be.equal("Unsuccessful change of seats in the hall.");
  78.         })
  79.  
  80.         it ("only 1 param passed", function() {
  81.             expect(cinema.swapSeatsInHall(5)).to.be.equal("Unsuccessful change of seats in the hall.");
  82.         })
  83.     })
  84. });
  85.  
  86.  
  87.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement