Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- describe("Tests …", function () {
- describe("First method", function () {
- it("Should have the right parameters", function () {
- expect(() => flowerShop.calcPriceOfFlowers(12, 54, 2).to.throw('Invalid input!'));
- });
- it("Should have the right parameters2", function () {
- expect(() => flowerShop.calcPriceOfFlowers('Rose', '54', 2).to.throw('Invalid input!'));
- expect(() => flowerShop.calcPriceOfFlowers('Rose', 54, '2').to.throw('Invalid input!'));
- expect(() => flowerShop.calcPriceOfFlowers('Rose', 4.3, 2).to.throw('Invalid input!'));
- expect(() => flowerShop.calcPriceOfFlowers('Rose', 54, 2.6).to.throw('Invalid input!'));
- });
- if ('Should round the result', function () {
- expect(() => flowerShop.calcPriceOfFlowers('Rose', 2, 2).to.equal('You need 4.00 to buy Rose!'));
- });
- });
- describe("Second method", function () {
- it("Should includes all the flowers", function () {
- // ["Rose", "Lily", "Orchid"]
- expect(flowerShop.checkFlowersAvailable('Orchid', ["Rose", "Lily", "Orchid"])).to.equal('The Orchid are available!');
- });
- it("Should return 'flower sold'", function () {
- expect(flowerShop.checkFlowersAvailable('Edelvais', ["Rose", "Lily", "Orchid"])).to.equal('The Edelvais are sold! You need to purchase more!');
- });
- });
- describe('Third method', () => {
- it('Should check the input', () => {
- expect(() => flowerShop.sellFlowers('some', 1)).to.throw('Invalid input!');
- expect(() => flowerShop.sellFlowers(["Rose", "Lily", "Orchid"], '8')).to.throw('Invalid input!');
- expect(() => flowerShop.sellFlowers(["Rose", "Lily", "Orchid"], 3.3)).to.throw('Invalid input!');
- expect(() => flowerShop.sellFlowers(["Rose", "Lily", "Orchid"], -1)).to.throw('Invalid input!');
- expect(() => flowerShop.sellFlowers(["Rose", "Lily", "Orchid"], 6)).to.throw('Invalid input!');
- });
- it('Should get a particular portion from the array', () => {
- expect(flowerShop.sellFlowers(["Rose", "Lily", "Orchid"], 2)).to.equal('Rose / Lily');
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement