import { expect, test } from "bun:test"
import { Tree, TREE_KINDS } from "../game/actors/Tree"

// The chunk baker (level.ts) accumulates geometry into a mesh per material key and
// only draws keys listed in MAT_ORDER. A tree species that declares a trunk/foliage
// material outside that palette would bake geometry that is silently never drawn.
// Freeze the palette here so a typo'd or unregistered material key fails a test.
const MATERIAL_KEYS = new Set(["grass", "rock", "bark", "birch", "leaf", "needle", "flower"])

test("every tree species maps to known chunk materials", () => {
  for (const kind of TREE_KINDS) {
    const s = Tree.species(kind)
    expect(s.kind).toBe(kind)
    expect(typeof s.build).toBe("function")
    expect(MATERIAL_KEYS.has(s.trunk)).toBe(true)
    expect(MATERIAL_KEYS.has(s.foliage)).toBe(true)
  }
})
