import test from 'node:test'; import assert from 'node:assert/strict'; import { buildChartSummaryText, createProfitChartPng } from '../src/chart.js'; test('creates a png buffer for mixed chart points', async () => { const buffer = await createProfitChartPng([ { label: '#1', runningProfit: -25 }, { label: '#2', runningProfit: 10 }, { label: '#3', runningProfit: 42.5 }, ]); assert.ok(Buffer.isBuffer(buffer)); assert.ok(buffer.length > 1000); assert.equal(buffer.subarray(0, 8).toString('hex'), '89504e470d0a1a0a'); }); test('builds an empty-state chart summary', () => { assert.match(buildChartSummaryText([]), /No resolved bets yet/i); });