UNPKG

jest-cucumber

Version:
26 lines 912 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.VendingMachine = void 0; var ITEM_COST = 0.50; var VendingMachine = /** @class */ (function () { function VendingMachine() { this.balance = 0; this.items = {}; } VendingMachine.prototype.stockItem = function (itemName, count) { this.items[itemName] = this.items[itemName] || 0; this.items[itemName] += count; }; VendingMachine.prototype.insertMoney = function (amount) { this.balance += amount; }; VendingMachine.prototype.dispenseItem = function (itemName) { if (this.balance >= ITEM_COST && this.items[itemName] > 0) { this.balance -= ITEM_COST; } this.items[itemName]--; }; return VendingMachine; }()); exports.VendingMachine = VendingMachine; //# sourceMappingURL=vending-machine.js.map