Advertisement
ErolKZ

Untitled

Feb 19th, 2022
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1.  
  2. describe("Tests …", function () {
  3.  
  4. describe("First method", function () {
  5.  
  6.  
  7. it("Should have the right parameters", function () {
  8.  
  9. expect(() => flowerShop.calcPriceOfFlowers(12, 54, 2).to.throw('Invalid input!'));
  10.  
  11. });
  12.  
  13.  
  14. it("Should have the right parameters2", function () {
  15.  
  16. expect(() => flowerShop.calcPriceOfFlowers('Rose', '54', 2).to.throw('Invalid input!'));
  17.  
  18. expect(() => flowerShop.calcPriceOfFlowers('Rose', 54, '2').to.throw('Invalid input!'));
  19.  
  20. expect(() => flowerShop.calcPriceOfFlowers('Rose', 4.3, 2).to.throw('Invalid input!'));
  21.  
  22. expect(() => flowerShop.calcPriceOfFlowers('Rose', 54, 2.6).to.throw('Invalid input!'));
  23.  
  24. });
  25.  
  26.  
  27. if ('Should round the result', function () {
  28.  
  29. expect(() => flowerShop.calcPriceOfFlowers('Rose', 2, 2).to.equal('You need 4.00 to buy Rose!'));
  30.  
  31. });
  32.  
  33. });
  34.  
  35.  
  36. describe("Second method", function () {
  37.  
  38. it("Should includes all the flowers", function () {
  39.  
  40. // ["Rose", "Lily", "Orchid"]
  41.  
  42. expect(flowerShop.checkFlowersAvailable('Orchid', ["Rose", "Lily", "Orchid"])).to.equal('The Orchid are available!');
  43.  
  44. });
  45.  
  46. it("Should return 'flower sold'", function () {
  47.  
  48. expect(flowerShop.checkFlowersAvailable('Edelvais', ["Rose", "Lily", "Orchid"])).to.equal('The Edelvais are sold! You need to purchase more!');
  49.  
  50. });
  51.  
  52. });
  53.  
  54. describe('Third method', () => {
  55.  
  56.  
  57. it('Should check the input', () => {
  58.  
  59. expect(() => flowerShop.sellFlowers('some', 1)).to.throw('Invalid input!');
  60.  
  61. expect(() => flowerShop.sellFlowers(["Rose", "Lily", "Orchid"], '8')).to.throw('Invalid input!');
  62.  
  63. expect(() => flowerShop.sellFlowers(["Rose", "Lily", "Orchid"], 3.3)).to.throw('Invalid input!');
  64.  
  65. expect(() => flowerShop.sellFlowers(["Rose", "Lily", "Orchid"], -1)).to.throw('Invalid input!');
  66.  
  67. expect(() => flowerShop.sellFlowers(["Rose", "Lily", "Orchid"], 6)).to.throw('Invalid input!');
  68.  
  69. });
  70.  
  71.  
  72. it('Should get a particular portion from the array', () => {
  73.  
  74. expect(flowerShop.sellFlowers(["Rose", "Lily", "Orchid"], 2)).to.equal('Rose / Lily');
  75.  
  76. });
  77.  
  78.  
  79. });
  80.  
  81. });
  82.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement