66// understand types, JSDoc, or TypeScript in order to complete this JavaScript
77// exercise, and can completely ignore this comment block and directive.
88
9+ import { act } from "react" ;
10+
911// 👋🏽 Hi there!
1012//
1113// On the JavaScript track we provide you with stubs. These stubs provide a
2931// work with the tests, which you can find in ./lasagna.spec.js
3032//
3133// Good luck preparing some lasagna!
32-
33- /**
34- * The number of minutes it takes to prepare a single layer.
34+ /*
35+ * The number of minutes it takes to prepare a single layer.
3536 */
3637const PREPARATION_MINUTES_PER_LAYER = 2 ;
3738
@@ -42,8 +43,14 @@ const PREPARATION_MINUTES_PER_LAYER = 2;
4243 * @param {number } actualMinutesInOven
4344 * @returns {number } the number of minutes remaining
4445 */
46+
47+ const EXPECTED_MINUTES_IN_OVEN = 40 ;
4548export function remainingMinutesInOven ( actualMinutesInOven ) {
46- throw new Error ( 'Remove this line and implement the function' ) ;
49+ if ( actualMinutesInOven > EXPECTED_MINUTES_IN_OVEN ) {
50+ throw new Error ( 'Actual minutes in oven cannot be more than expected minutes in oven' ) ;
51+ }
52+ return EXPECTED_MINUTES_IN_OVEN - actualMinutesInOven ;
53+
4754}
4855
4956/**
@@ -53,7 +60,7 @@ export function remainingMinutesInOven(actualMinutesInOven) {
5360 * @returns {number } the total preparation time
5461 */
5562export function preparationTimeInMinutes ( numberOfLayers ) {
56- throw new Error ( 'Remove this line and implement the function' ) ;
63+ return numberOfLayers * PREPARATION_MINUTES_PER_LAYER ;
5764}
5865
5966/**
@@ -65,5 +72,5 @@ export function preparationTimeInMinutes(numberOfLayers) {
6572 * @returns {number } the total working time
6673 */
6774export function totalTimeInMinutes ( numberOfLayers , actualMinutesInOven ) {
68- throw new Error ( 'Remove this line and implement the function' ) ;
75+ return preparationTimeInMinutes ( numberOfLayers ) + actualMinutesInOven ;
6976}
0 commit comments