import { readFileSync } from "node:fs"
import path from "node:path"
import { fileURLToPath } from "node:url"

const __dirname = path.dirname(fileURLToPath(import.meta.url))
const FIXTURES_DIR = path.resolve(__dirname, "..", "fixtures")

export const FIXTURES_DIR_ABS = FIXTURES_DIR

export function loadFixture(name: string): string {
  const fixturePath = path.join(FIXTURES_DIR, `${name}.svg`)
  return readFileSync(fixturePath, "utf-8")
}