testEngine method

Future<Map<String, dynamic>> testEngine()

Test if engine is working correctly

Implementation

Future<Map<String, dynamic>> testEngine() async {
  try {
    // Simple test rule: check if execution context works
    final testRule = {
      'nodes': {
        'root': {
          'id': 'root',
          'type': 'doActions',
          'inputData': {},
          'connections': {
            'inputs': <String, List<Map<String, dynamic>>>{},
            'outputs': <String, List<Map<String, dynamic>>>{},
          },
          'root': true,
        },
      },
    };

    await executeRules(ruleDefinition: testRule);

    return {
      'success': true,
      'message': 'Dart Rules Engine is working correctly',
      'engine_type': 'dart_native',
    };
  } catch (e) {
    return {
      'success': false,
      'error': e.toString(),
      'engine_type': 'dart_native',
    };
  }
}