fix: price data update time serialization

price update time was not properly serialized as a number like the schema was, and led to dates being stored as empty objects. UI code also did not check if date was NaN, and rendered "invalid date" instead.
This commit is contained in:
xenticore
2025-03-29 14:19:38 -04:00
parent 13a8e14284
commit be6206194b
3 changed files with 10 additions and 8 deletions

View File

@@ -94,7 +94,7 @@ describe('Price Service', () => {
test('ItemPriceData.toString() returns formatted string', () => {
const data = new ItemPriceData()
data.sku = mockSku
data.update = mockDate
data.update = mockDate.getTime()
data.ttl = mockTtl
data.keys = 1
data.metal = 10.66
@@ -102,6 +102,8 @@ describe('Price Service', () => {
const result = data.toString()
expect(result).toContain(`Price for ${mockSku}`)
expect(result).toContain(mockDate.toString())
expect(result).toContain(new Date(mockDate.getTime() + mockTtl).toString())
expect(result).toContain(`"keys":${data.keys}`)
expect(result).toContain(`"metal":${data.metal}`)
expect(result).toContain(`"scmPrice":${data.scmPrice}`)