Advertisement
bebo231312312321

Untitled

Oct 16th, 2024
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. describe('Trip tests', () => {
  2.     it('choosingDestination', () => {
  3.         expect(() => { planYourTrip.choosingDestination('Ski Resort', 'Winter', 2004) }).to.throw('Invalid Year!');
  4.         expect(() => { planYourTrip.choosingDestination('Ski Resort', 'Winter', null) }).to.throw('Invalid Year!');
  5.         expect(() => { planYourTrip.choosingDestination('Ski Resort', 'Winter', undefined) }).to.throw('Invalid Year!');
  6.         expect(() => { planYourTrip.choosingDestination('Island', 'Winter', 2024) }).to.throw('This destination is not what you are looking for.');
  7.         expect(() => { planYourTrip.choosingDestination(0, 'Winter', 2024) }).to.throw('This destination is not what you are looking for.');
  8.         expect(planYourTrip.choosingDestination('Ski Resort', 'Summer', 2024)).to.equal('Consider visiting during the Winter for the best experience at the Ski Resort.');
  9.         expect(planYourTrip.choosingDestination('Ski Resort', 'Winter', 2024)).to.equal('Great choice! The Winter is the perfect time to visit the Ski Resort.');
  10.     });
  11.  
  12.     it('exploreOptions', () => {
  13.         expect(() => { planYourTrip.exploreOptions('Swim', 1) }).to.throw('Invalid Information!');
  14.         expect(() => { planYourTrip.exploreOptions(['Swim'], 'a') }).to.throw('Invalid Information!');
  15.         expect(() => { planYourTrip.exploreOptions(['Swim'], 3.1) }).to.throw('Invalid Information!');
  16.         expect(() => { planYourTrip.exploreOptions(['Swim'], 1) }).to.throw('Invalid Information!');
  17.         expect(() => { planYourTrip.exploreOptions(['Swim'], -1) }).to.throw('Invalid Information!');
  18.         expect(planYourTrip.exploreOptions(['Swim', 'Ride', 'Slide'], 1)).to.equal('Swim, Slide');
  19.     });
  20.  
  21.     it('estimateExpenses', () => {
  22.         expect(() => { planYourTrip.estimateExpenses('5', '5') }).to.throw('Invalid Information!');
  23.         expect(() => { planYourTrip.estimateExpenses(5, '5') }).to.throw('Invalid Information!');
  24.         expect(() => { planYourTrip.estimateExpenses('5', 5) }).to.throw('Invalid Information!');
  25.         expect(() => { planYourTrip.estimateExpenses(0, 5) }).to.throw('Invalid Information!');
  26.         expect(() => { planYourTrip.estimateExpenses(5, "string") }).to.throw('Invalid Information!');
  27.         expect(() => { planYourTrip.estimateExpenses(5, []) }).to.throw('Invalid Information!');
  28.         expect(() => { planYourTrip.estimateExpenses(5, {}) }).to.throw('Invalid Information!');
  29.         expect(() => { planYourTrip.estimateExpenses(5, true) }).to.throw('Invalid Information!');
  30.         expect(() => { planYourTrip.estimateExpenses(5, -1) }).to.throw('Invalid Information!');
  31.         expect(() => { planYourTrip.estimateExpenses(-5, 1) }).to.throw('Invalid Information!');
  32.  
  33.         expect(() => { planYourTrip.estimateExpenses("string", 5) }).to.throw('Invalid Information!');
  34.         expect(() => { planYourTrip.estimateExpenses([], 5) }).to.throw('Invalid Information!');
  35.         expect(() => { planYourTrip.estimateExpenses({}, 5) }).to.throw('Invalid Information!');
  36.         expect(() => { planYourTrip.estimateExpenses(true, 5) }).to.throw('Invalid Information!');
  37.         expect(planYourTrip.estimateExpenses(50, 5)).to.equal('The trip is budget-friendly, estimated cost is $250.00.');
  38.         expect(planYourTrip.estimateExpenses(50, 10)).to.equal('The trip is budget-friendly, estimated cost is $500.00.');
  39.         expect(planYourTrip.estimateExpenses(500, 5)).to.equal('The estimated cost for the trip is $2500.00, plan accordingly.');
  40.     });
  41. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement