Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- describe('Tests cinema', function () {
- describe('showMovies ', function () {
- it('assert with valid params', function () {
- assert.equal(
- cinema.showMovies(['King Kong', 'The Tomorrow War', 'Joker']),
- 'King Kong, The Tomorrow War, Joker'
- );
- assert.equal(cinema.showMovies(['Joker']), 'Joker');
- assert.equal(
- cinema.showMovies([]),
- 'There are currently no movies to show.'
- );
- });
- });
- describe('ticketPrice', function () {
- it('assert with valid param', function () {
- assert.equal(cinema.ticketPrice('Premiere'), 12);
- assert.equal(cinema.ticketPrice('Normal'), 7.5);
- assert.equal(cinema.ticketPrice('Discount'), 5.5);
- });
- it('assert with invalid param', function () {
- assert.throw(
- () => cinema.ticketPrice('Premi'),
- 'Invalid projection type.'
- );
- assert.throw(
- () => cinema.ticketPrice(''),
- 'Invalid projection type.'
- );
- assert.throw(
- () => cinema.ticketPrice(),
- 'Invalid projection type.'
- );
- });
- });
- describe('swapSeatsInHall', function () {
- it('assert with valid params', function () {
- assert.equal(cinema.swapSeatsInHall(1, 20), 'Successful change of seats in the hall.');
- assert.equal(
- cinema.swapSeatsInHall(19, 20),
- 'Successful change of seats in the hall.'
- );
- assert.equal(
- cinema.swapSeatsInHall(20, 19),
- 'Successful change of seats in the hall.'
- );
- });
- it('assert with invalid params', function () {
- assert.equal(
- cinema.swapSeatsInHall(20, 20),
- 'Unsuccessful change of seats in the hall.'
- );
- assert.equal(
- cinema.swapSeatsInHall(0, 1),
- 'Unsuccessful change of seats in the hall.'
- );
- assert.equal(
- cinema.swapSeatsInHall(1, 0),
- 'Unsuccessful change of seats in the hall.'
- );
- assert.equal(
- cinema.swapSeatsInHall(-1, 9),
- 'Unsuccessful change of seats in the hall.'
- );
- assert.equal(
- cinema.swapSeatsInHall(2, -9),
- 'Unsuccessful change of seats in the hall.'
- );
- assert.equal(
- cinema.swapSeatsInHall(2, 21),
- 'Unsuccessful change of seats in the hall.'
- );
- assert.equal(
- cinema.swapSeatsInHall(21, 7),
- 'Unsuccessful change of seats in the hall.'
- );
- assert.equal(
- cinema.swapSeatsInHall('9', 7),
- 'Unsuccessful change of seats in the hall.'
- );
- assert.equal(
- cinema.swapSeatsInHall(9, '7'),
- 'Unsuccessful change of seats in the hall.'
- );
- assert.equal(
- cinema.swapSeatsInHall(5.5, 7),
- 'Unsuccessful change of seats in the hall.'
- );
- assert.equal(
- cinema.swapSeatsInHall(9, 4.6),
- 'Unsuccessful change of seats in the hall.'
- );
- assert.equal(
- cinema.swapSeatsInHall(7,),
- 'Unsuccessful change of seats in the hall.'
- );
- assert.equal(
- cinema.swapSeatsInHall(null, 6),
- 'Unsuccessful change of seats in the hall.'
- );
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement