package main

import (
	"os"
	"path/filepath"
	"testing"
)

func TestExportPlayworksNetworksForRuntimeCheck(t *testing.T) {
	outDir := os.Getenv("PLAYWORKS_EXPORT_DIR")
	if outDir == "" {
		t.Skip("PLAYWORKS_EXPORT_DIR not set")
	}

	sourcePath := filepath.Join("..", "aiAssets", "DogCat3_Full.html")
	data, err := os.ReadFile(sourcePath)
	if err != nil {
		t.Fatalf("read source: %v", err)
	}

	opts := playworksConvertOptions{
		SourcePath: sourcePath,
		OutputDir:  outDir,
		BaseName:   "wat_mip_grhpl_dogcat3_05_real_na_noseason_en_full_na",
	}

	if _, err := copyPlayworksUnityInput(data, opts); err != nil {
		t.Fatalf("copy unity input: %v", err)
	}

	for _, network := range []string{"al", "ap", "fb", "gg", "is", "mo", "mtg", "vu"} {
		if _, err := convertPlayworksNetwork(string(data), opts, network); err != nil {
			t.Fatalf("convert %s: %v", network, err)
		}
	}
}
