From 73fbd2cde33d56e5e6c9ec9882511842c3da69ff Mon Sep 17 00:00:00 2001 From: Mofeng <363034937@qq.com> Date: Sat, 3 Feb 2024 16:56:47 +0800 Subject: [PATCH] test: add test for hardcoded string literal value --- dist/screeps-tests.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dist/screeps-tests.ts b/dist/screeps-tests.ts index dda67c7..71cbe75 100644 --- a/dist/screeps-tests.ts +++ b/dist/screeps-tests.ts @@ -378,6 +378,21 @@ function resources(o: GenericStore): ResourceConstant[] { Game.market.createOrder({ type: ORDER_SELL, resourceType: RESOURCE_GHODIUM, price: 9.95, totalAmount: 10000, roomName: "W1N1" }); Game.market.createOrder({ type: ORDER_SELL, resourceType: RESOURCE_GHODIUM, price: 9.95, totalAmount: 10000 }); + // Testing the hardcoded string literal value of the `type` field + { + // error + Game.market.createOrder({ + // @ts-expect-error + type: "BUY", + resourceType: RESOURCE_GHODIUM, + price: 9.95, + totalAmount: 10000, + }); + + // okay + Game.market.createOrder({ type: "buy", resourceType: RESOURCE_GHODIUM, price: 9.95, totalAmount: 10000 }); + } + // Game.market.deal(orderId, amount, [yourRoomName]) Game.market.deal("57cd2b12cda69a004ae223a3", 1000, "W1N1");