Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const { assert } = require('chai');
- const { expect } = require('chai');
- const library = require('./template');
- describe("Test", function () {
- it("Test1", () => {
- assert.throws(() => library({}));
- assert.throws(() => library.calcPriceOfBook({}));
- assert.throws(() => library.calcPriceOfBook({}), 'Invalid input');
- assert.equal(library.calcPriceOfBook('Pesho', 2000), 'Price of Pesho is 20.00');
- assert.equal(library.calcPriceOfBook('', 2000), 'Price of is 20.00');
- assert.throws(() => library.calcPriceOfBook(123, 2000), 'Invalid input');
- assert.throws(() => library.calcPriceOfBook(null, 2000), 'Invalid input');
- assert.equal(library.calcPriceOfBook('Pesho', 1000), 'Price of Pesho is 10.00');
- assert.equal(library.calcPriceOfBook('Pesho', 1000), 'Price of Pesho is 10.00');
- assert.equal(library.calcPriceOfBook('Pesho', -1000), 'Price of Pesho is 10.00');
- });
- it("Test2", function () {
- assert.equal(library.findBook(['book1', 'book2'], 'book2') ,'We found the book you want.');
- assert.equal(library.findBook(['book1'], 'book1') ,'We found the book you want.');
- assert.throws(() => library.findBook([], 'book1'), 'No books currently available');
- assert.equal(library.findBook(['book1', 'book2'], 'book3') ,'The book you are looking for is not here!');
- });
- it("Test3", function () {
- assert.throws(() => library.arrangeTheBooks(5.5), 'Invalid input');
- assert.throws(() => library.arrangeTheBooks(-5), 'Invalid input');
- assert.throws(() => library.arrangeTheBooks(''), 'Invalid input');
- assert.equal(library.arrangeTheBooks(5) ,'Great job, the books are arranged.');
- assert.equal(library.arrangeTheBooks(40) ,'Great job, the books are arranged.');
- assert.equal(library.arrangeTheBooks(41) ,'Insufficient space, more shelves need to be purchased.');
- assert.equal(library.arrangeTheBooks(5555), 'Insufficient space, more shelves need to be purchased.');
- });
- });
- //assert.throws(() => numberOperations.numberChecker('str'), 'The input is not a number!');
- //assert.equal(dealership.newCarCost('Audi A4 B8', 100000), 85000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement