Advertisement
didkoslawow

Untitled

May 14th, 2023
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. describe('Tests for weddingDay', () => {
  2.   it('pickVenue', () => {
  3.     expect(() => weddingDay.pickVenue('', 1, 1)).to.throw();
  4.     expect(() => weddingDay.pickVenue(1, '', 1)).to.throw();
  5.     expect(() => weddingDay.pickVenue('', '', '')).to.throw();
  6.     expect(() => weddingDay.pickVenue(1, 1, [])).to.throw();
  7.     expect(() => weddingDay.pickVenue(1, 1, {})).to.throw();
  8.     expect(() => weddingDay.pickVenue({}, 1, 'Varna')).to.throw();
  9.     expect(() => weddingDay.pickVenue([], 1, 'Varna')).to.throw();
  10.     expect(() => weddingDay.pickVenue(1, {}, 'Varna')).to.throw();
  11.     expect(() => weddingDay.pickVenue(1, [], 'Varna')).to.throw();
  12.     expect(() => weddingDay.pickVenue(1, 1, 'Test')).to.throw();
  13.     expect(() => weddingDay.pickVenue(1, 1, '[]')).to.throw();
  14.     expect(() => weddingDay.pickVenue(1, 1, '{}')).to.throw();
  15.     expect(() => weddingDay.pickVenue(1, 1, '0')).to.throw();
  16.     expect(weddingDay.pickVenue(150, 120, 'Varna')).to.equal(
  17.       'This venue meets the requirements, with capacity of 150 guests and 120$ cover.'
  18.     );
  19.     expect(weddingDay.pickVenue(151, 119, 'Varna')).to.equal(
  20.       'This venue meets the requirements, with capacity of 151 guests and 119$ cover.'
  21.     );
  22.     expect(weddingDay.pickVenue(149, 120, 'Varna')).to.not.equal(
  23.       'This venue meets the requirements, with capacity of 151 guests and 119$ cover.'
  24.     );
  25.     expect(weddingDay.pickVenue(150, 121, 'Varna')).to.not.equal(
  26.       'This venue meets the requirements, with capacity of 151 guests and 119$ cover.'
  27.     );
  28.     expect(weddingDay.pickVenue(149, 121, 'Varna')).to.equal('This venue does not meet your requirements!');
  29.     expect(weddingDay.pickVenue(149, 120, 'Varna')).to.equal('This venue does not meet your requirements!');
  30.     expect(weddingDay.pickVenue(150, 121, 'Varna')).to.equal('This venue does not meet your requirements!');
  31.     expect(() => weddingDay.pickVenue(1, 1, 'Varna')).to.not.throw();
  32.   });
  33.  
  34.   it('otherSpendings', () => {
  35.     expect(() => weddingDay.otherSpendings({}, {}, {})).to.throw();
  36.     expect(() => weddingDay.otherSpendings([], {}, {})).to.throw();
  37.     expect(() => weddingDay.otherSpendings([], [], {})).to.throw();
  38.     expect(() => weddingDay.otherSpendings('', [], true)).to.throw();
  39.     expect(() => weddingDay.otherSpendings([], [], true)).to.not.throw();
  40.     expect(weddingDay.otherSpendings(['flowers', 'Fabric drapes and curtains'], ['pictures', 'video'], false)).to.equal(
  41.       'You spend 2900$ for wedding decoration and photography!'
  42.     );
  43.     expect(weddingDay.otherSpendings(['flowers'], ['pictures'], false)).to.equal(
  44.       'You spend 1200$ for wedding decoration and photography!'
  45.     );
  46.     expect(weddingDay.otherSpendings(['Fabric drapes and curtains'], ['video'], false)).to.equal(
  47.       'You spend 1700$ for wedding decoration and photography!'
  48.     );
  49.     expect(weddingDay.otherSpendings(['flowers', 'Fabric drapes and curtains'], ['pictures', 'video'], true)).to.equal(
  50.       'You spend 2465$ for wedding decoration and photography with 15% discount!'
  51.     );
  52.     expect(weddingDay.otherSpendings(['flowers'], ['pictures'], true)).to.equal(
  53.       'You spend 1020$ for wedding decoration and photography with 15% discount!'
  54.     );
  55.     expect(weddingDay.otherSpendings(['Fabric drapes and curtains'], ['video'], true)).to.equal(
  56.       'You spend 1445$ for wedding decoration and photography with 15% discount!'
  57.     );
  58.   });
  59.  
  60.   it('tableDistribution', () => {
  61.     expect(() => weddingDay.tableDistribution('', '')).to.throw();
  62.     expect(() => weddingDay.tableDistribution([], [])).to.throw();
  63.     expect(() => weddingDay.tableDistribution('', 1)).to.throw();
  64.     expect(() => weddingDay.tableDistribution(1, '')).to.throw();
  65.     expect(() => weddingDay.tableDistribution(-1, '')).to.throw();
  66.     expect(() => weddingDay.tableDistribution('', -1)).to.throw();
  67.     expect(() => weddingDay.tableDistribution(-1, -1)).to.throw();
  68.     expect(() => weddingDay.tableDistribution({}, 1)).to.throw();
  69.     expect(() => weddingDay.tableDistribution(1, {})).to.throw();
  70.     expect(() => weddingDay.tableDistribution(1, 1)).to.not.throw();
  71.     expect(weddingDay.tableDistribution(210, 30)).to.equal('You have 30 tables with 7 guests on table.');
  72.     expect(weddingDay.tableDistribution(160, 20)).to.equal('You have 20 tables with 8 guests on table.');
  73.     expect(weddingDay.tableDistribution(100, 20)).to.equal('There is only 5 people on every table, you can join some tables.');
  74.   });
  75. });
  76.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement