03. Movie Theater от JS Advanced Retake Exam - 10 Aug 2022
Здравейте, получавам 70/100, някой може ли да ми помогне ?
Благодаря :)
задача: https://judge.softuni.org/Contests/Practice/Index/3565#2
код:
describe('movieTheater', () => {
it(' ageRestrictions', () => {
expect( movieTheater.ageRestrictions('G') ).to.equal('All ages admitted to watch the movie');
expect( movieTheater.ageRestrictions('PG') ).to.equal('Parental guidance suggested! Some material may not be suitable for pre-teenagers');
expect( movieTheater.ageRestrictions('R') ).to.equal('Restricted! Under 17 requires accompanying parent or adult guardian');
expect( movieTheater.ageRestrictions('NC-17') ).to.equal('No one under 17 admitted to watch the movie');
expect( movieTheater.ageRestrictions('whatever') ).to.equal('There are no age restrictions for this movie');
});
it('moneySpent', () => {
expect(() => { movieTheater.moneySpent('Z', ['Nachos', 'Popcorn'], ['Soda', 'Water']) }).to.throw('Invalid input');
expect(() => { movieTheater.moneySpent('Z', 'Z', ['Soda', 'Water']) }).to.throw('Invalid input');
expect(() => { movieTheater.moneySpent('Z', 'Z', 'Z') }).to.throw('Invalid input');
expect(() => { movieTheater.moneySpent('Z', ['Soda', 'Water'], 'Z') }).to.throw('Invalid input');
expect(() => { movieTheater.moneySpent(3, ['Soda', 'Water'], 'Z') }).to.throw('Invalid input');
expect(() => { movieTheater.moneySpent(350, 'Z', ['Soda', 'Water']) }).to.throw('Invalid input');
expect(movieTheater.moneySpent(3, ['Nachos', 'Popcorn'], ['Soda', 'Water'])).to.equal(`The total cost for the purchase with applied discount is 47.60`);
expect(movieTheater.moneySpent(3, ['Nachos'], ['Soda'])).to.equal(`The total cost for the purchase with applied discount is 42.80`);
expect(movieTheater.moneySpent(2, ['Nachos'], ['Soda'])).to.equal(`The total cost for the purchase is 38.50`);
expect(movieTheater.moneySpent(2, ['Popcorn'], ['Soda'])).to.equal('The total cost for the purchase is 37.00');
expect(movieTheater.moneySpent(2, ['Popcorn'], ['Water'])).to.equal('The total cost for the purchase is 36.00');
expect(movieTheater.moneySpent(2, ['Nachos'], ['Water'])).to.equal('The total cost for the purchase is 37.50');
});
it('reservation', () => {
expect(() => { movieTheater.reservation('3', 3) }).to.throw('Invalid input');
expect(() => { movieTheater.reservation(['3', 'string'], 1) }).to.throw('Invalid input');
expect(() => { movieTheater.reservation(['3', 'string'], '3') }).to.throw('Invalid input');
expect(['23', '25', '27'], 2).to.equal(2);
});
})