Проблем със задача 03. Pizza place от JS Advanced - Exam Prep 1 - 12.02.2021
Здравейте,
Решавам задачата 03. Pizza place, unit test задача, обаче когато пусна следния код в judge, ми дава 0/100, макар че работи безпроблемно в програмата. Може ли някой да ми помогне?
Благодаря предварително!
Линк към задачата: https://judge.softuni.bg/Contests/Practice/Index/2860#2
Кода ми:
const {makeAnOrder, getRemainingWork, orderType} = require('./pizza.js');
const chai = require('chai');
describe("pizza", function() {
describe("makeAnOrder", function() {
it("Should return Correct w/ food & drink", function() {
chai.assert.equal(makeAnOrder({orderedPizza: "the name of the pizza", orderedDrink: "the name of the drink"}),"You just ordered the name of the pizza and the name of the drink.");
});
it("Should return Correct w/ food", function() {
chai.assert.equal(makeAnOrder({orderedPizza: "the name of the pizza."}),"You just ordered the name of the pizza.");
});
it("Should return Error when !orderedPizza", function() { //HOW TO MAKE AN ERROR!
chai.assert.throw(() => {
makeAnOrder({});
}, 'You must order at least 1 Pizza to finish the order.');
});
});
describe("getRemainingWork", function() {
it("Should return Correct when READY", function() {
chai.assert.equal(getRemainingWork([{pizzaName: "the name of the pizza", status: "ready"}]), "All orders are complete!");
});
it("Should return Correct when PREPARING", function() {
chai.assert.equal(getRemainingWork([{pizzaName: "the name of the pizza", status: "preparing"}]), "The following pizzas are still preparing: the name of the pizza.");
});
});
describe("orderType", function() {
it("Should return Correct when CARRY OUT", function() {
chai.assert.equal(orderType(50, "Carry Out"), 45);
});
it("Should return Correct when DELIVERY", function() {
chai.assert.equal(orderType(50, "Delivery"), 50);
});
});
});