Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- describe("testing class Warehouse", function () {
- let ware;
- beforeEach(function () {
- ware = new Warehouse(10);
- });
- describe("testing the capacity getter and setter", function () {
- it("testing capacity setter with non-number and with negative number", function () {
- let expected = () => {
- ware.capacity = '0';
- }
- expect(expected).to.throw('Invalid given warehouse space');
- });
- });
- describe("testing if all the methods exists", function () {
- it("testing addProduct method with bigger number than capacity", function () {
- let expected = () => {
- ware.addProduct('Food', 'banana', 12);
- }
- expect(expected).to.throw('There is not enough space or the warehouse is already full');
- });
- it("testing revision in empty warehouse", function () {
- let expected = ware.revision();
- expect(expected).to.be.equal('The warehouse is empty');
- });
- it("testing scrapeAProduct method with non-existing product", function () {
- let expected = () => {
- ware.scrapeAProduct('orange', 2);
- }
- expect(expected).to.throw('orange do not exists');
- });
- it("orderProducts(type) functionality", function () {
- let ware = new Warehouse(3);
- ware.addProduct("Food", "a", 1);
- ware.addProduct("Food", "b", 2);
- ware.orderProducts("Food");
- let expected = Object.entries(ware.availableProducts["Food"])[0][1];
- expect(expected).to.equal(2);
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement