Skip to content

Commit

Permalink
y
Browse files Browse the repository at this point in the history
  • Loading branch information
Owen3H committed Jul 8, 2024
1 parent 2071cc5 commit b620860
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/api/squaremap/Towns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class Towns implements EntityApi<SquaremapTown | NotFoundError> {
readonly totalWealth = async() => {
// Could do this with nations instead, but towns is likely to be more reliable.
const towns = await this.all()
return towns.reduce((acc, cur) => acc + cur.wealth, 0)
return towns.reduce((acc, cur) => acc + cur.wealth || 0, 0)
}
}

Expand Down
14 changes: 7 additions & 7 deletions src/api/squaremap/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,16 +284,16 @@ export const parsePlayers = (players: SquaremapRawPlayer[]) => {
}

//#region TESTING
import { endpoint, type SquaremapMapResponse } from 'src/main.js'
// import { endpoint, type SquaremapMapResponse } from 'src/main.js'

async function test() {
const res = await endpoint.mapData<SquaremapMapResponse>('aurora')
const markerset = res.find(x => x.id == "towny")
// async function test() {
// const res = await endpoint.mapData<SquaremapMapResponse>('aurora')
// const markerset = res.find(x => x.id == "towny")

await parseTowns(markerset)
}
// await parseTowns(markerset)
// }

test()
// test()
//#endregion

//#region OLD STUFF
Expand Down
2 changes: 1 addition & 1 deletion tests/squaremap/map.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { describe, it, expect, assertType } from 'vitest'
import { Aurora } from '../../src/main'

describe('[Squaremap/Aurora] Map', () => {
it('can get accurate total map wealth', async () => {
it.skip('can get accurate total map wealth', async () => {
const wealth = await Aurora.Towns.totalWealth()

expect(wealth).toBeTruthy()
Expand Down

0 comments on commit b620860

Please sign in to comment.