import test from "node:test"; import assert from "node:assert/strict"; import { ItemId } from "../../shared/definitions/items.js"; import { canSellOnMarketplace, assertMarketplaceSellable } from "../../shared/items/marketplace.js"; test("blank cheques cannot be listed on the marketplace", () => { const stack = { itemId: ItemId.blankCheque, quantity: 1 }; assert.equal(canSellOnMarketplace(stack), false); assert.throws( () => assertMarketplaceSellable(stack), (err) => err.message === "Blank cheques cannot be sold on the marketplace." ); }); test("written cheques can be listed on the marketplace", () => { const stack = { itemId: ItemId.filledCheque, quantity: 1, instance: { kind: "filled-cheque", chequeId: "x", issuerCharacterId: 1, itemId: ItemId.apple, quantity: 2 } }; assert.equal(canSellOnMarketplace(stack), true); assert.doesNotThrow(() => assertMarketplaceSellable(stack)); }); test("normal items are marketplace sellable by default", () => { assert.equal(canSellOnMarketplace({ itemId: ItemId.apple, quantity: 3 }), true); });