import assert from "node:assert/strict"; import test from "node:test"; import { resolveAuctionErrorMessage, resolveAuctionRejectionMessage, } from "../src/api/auctionRejectionMessages.ts"; const rosterMessage = "팀 배정 상태를 확인해야 해 경매를 완료하지 못했습니다."; test("asks an outdated client to reload instead of claiming the player advanced", () => { const message = "경매 화면이 업데이트되었습니다. 새로고침한 뒤 다시 입찰해 주세요."; assert.equal( resolveAuctionRejectionMessage({ auctionRejectionReason: "BID_REJECTED_BECAUSE_CLIENT_UPDATE_REQUIRED", message, }), message, ); // An older bundle without the new reason mapping still displays the server message. assert.equal( resolveAuctionRejectionMessage({ auctionRejectionReason: "UNRECOGNIZED_NEW_CLIENT_REASON", message, }), message, ); }); test("shows the common error message when roster validation blocks completion", () => { assert.equal( resolveAuctionRejectionMessage({ auctionRejectionReason: "AUCTION_TRANSITION_REJECTED_BECAUSE_ROSTER_INVALID", code: "AUCTION_ROSTER_INVALID", message: "Auction roster validation failed.", }), rosterMessage, ); }); test("shows the same roster message for the socket error event", () => { assert.equal( resolveAuctionErrorMessage("Auction roster validation failed."), rosterMessage, ); });