import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import test from 'node:test'
import { fileURLToPath } from 'node:url'

const donutChart = readFileSync(
  fileURLToPath(new URL('../src/components/charts/DonutChart.vue', import.meta.url)),
  'utf8'
)

test('donut chart supports hiding its built-in legend without changing the default', () => {
  assert.match(donutChart, /showLegend: \{ type: Boolean, default: true \}/)
  assert.match(donutChart, /v-if="showLegend" class="donut-legend"/)
  assert.match(donutChart, /donut-chart--legendless/)
})
