const { default: init, version, list_available_fluids, WasmSystem, WasmPressure, WasmTemperature, WasmFallbackConfig } = require('../pkg/entropyk_wasm.js');

async function main() {
    // Initialize WASM module
    await init();
    
    console.log('Entropyk WASM Test');
    console.log('===================');
    console.log('Version:', version());
    
    // Test fluid listing
    const fluids = list_available_fluids();
    console.log('Available fluids:', fluids);
    
    // Test pressure creation
    const p = new WasmPressure(101325.0);
    console.log('Pressure (Pa):', p.pascals());
    console.log('Pressure (bar):', p.bar());
    
    // Test temperature creation
    const t = WasmTemperature.from_celsius(25.0);
    console.log('Temperature (K):', t.kelvin());
    console.log('Temperature (°C):', t.celsius());
    
    // Test system creation
    const system = new WasmSystem();
    console.log('System created');
    console.log('Node count:', system.node_count());
    console.log('Edge count:', system.edge_count());
    
    // Test solver configuration
    const config = new WasmFallbackConfig();
    config.timeout_ms(1000);
    
    // Test JSON output
    console.log('System JSON:', system.toJson());
    
    console.log('\nAll tests passed!');
}

main().catch(err => {
    console.error('Test failed:', err);
    process.exit(1);
});
