Inventory things
This commit is contained in:
parent
6db28fd2bc
commit
99ccca2412
|
@ -1,5 +1,5 @@
|
|||
prefixes:
|
||||
- id: "*"
|
||||
- id: "**"
|
||||
spaced: false
|
||||
- id: cosmic
|
||||
- id: cdebug
|
||||
spaced: true
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
debug: false
|
||||
enableConsole: false
|
||||
debug: true
|
||||
enableConsole: true
|
||||
enableMPP: true
|
||||
enableDiscord: true
|
||||
enableDiscord: false
|
||||
enableSwitchChat: false
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"module": "src/index.ts",
|
||||
"type": "module",
|
||||
"devDependencies": {
|
||||
"bun-types": "latest"
|
||||
"bun-types": "^1.0.16"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"typescript": "^5.0.0"
|
||||
|
|
|
@ -42,7 +42,7 @@ export async function updateInventory(data: Omit<Inventory, "id">) {
|
|||
where: { userId: data.userId },
|
||||
data: {
|
||||
balance: data.balance,
|
||||
items: data.items as any
|
||||
items: JSON.stringify(data.items)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
import { expect, test } from "bun:test";
|
||||
import { collapseInventory } from "../../src/data/inventory";
|
||||
import { StackableItem } from "../../src/economy/Item";
|
||||
|
||||
test("Collapse inventory", () => {
|
||||
let sampleData: StackableItem[] = [
|
||||
{
|
||||
id: "test_item",
|
||||
name: "Test Item",
|
||||
count: 10
|
||||
},
|
||||
{
|
||||
id: "test_item",
|
||||
name: "Test Item",
|
||||
count: 15
|
||||
}
|
||||
];
|
||||
|
||||
collapseInventory(sampleData);
|
||||
expect(sampleData[0].count).toBe(25);
|
||||
expect(sampleData[1]).toBe(undefined);
|
||||
console.log(sampleData);
|
||||
});
|
Loading…
Reference in New Issue