dump static method
void
dump()
Dump current test state to console.
Prints:
- Backpack contents
- Current route
- Mocked APIs
- Time state
- Cache contents
Implementation
static void dump() {
print('╔════════════════════════════════════════════════════════════════╗');
print('║ NyTest State Dump ║');
print('╠════════════════════════════════════════════════════════════════╣');
// Test mode
print('║ Test Mode: ${Nylo.isTestMode}');
// Current user
print('║ Acting As: ${_currentUser ?? 'Guest'}');
// Time
print('║ Time Frozen: ${NyTime.isFrozen}');
if (NyTime.isFrozen) {
print('║ Test Time: ${NyTime.now().toIso8601String()}');
}
// Backpack
print('╠════════════════════════════════════════════════════════════════╣');
print('║ Backpack Contents:');
// Can't easily enumerate Backpack, but we can check common keys
if (Nylo.isInitialized()) {
print('║ - nylo: initialized');
}
if (_currentUser != null) {
print('║ - auth_user: $_currentUser');
}
// Current route
print('╠════════════════════════════════════════════════════════════════╣');
print('║ Current Route: ${Nylo.getCurrentRouteName() ?? 'None'}');
// Route history
final history = Nylo.getRouteHistory();
if (history.isNotEmpty) {
print('║ Route History:');
for (final route in history) {
print('║ - ${route['name']}');
}
}
// API mocks
print('╠════════════════════════════════════════════════════════════════╣');
print(
'║ API Mocks: ${NyMockApi.handlerCount} handlers, ${NyMockApi.patternCount} patterns',
);
// API call history
final calls = NyMockApi.getCalls();
if (calls.isNotEmpty) {
print('║ API Call History:');
for (final call in calls) {
print('║ - ${call.method} ${call.endpoint}');
}
}
// Cache
final cache = NyTestCache.getInstance();
print('╠════════════════════════════════════════════════════════════════╣');
print('║ Cache: ${cache.count} entries');
if (cache.isNotEmpty) {
print('║ Cache Keys:');
for (final key in cache.entries.keys) {
print('║ - $key');
}
}
print('╚════════════════════════════════════════════════════════════════╝');
}