36 lines
1.7 KiB
Dart
36 lines
1.7 KiB
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:glitch_gm_lab/hint_panel.dart';
|
|
|
|
void main() {
|
|
test('suggestions follow parallel branches and claw prerequisites', () {
|
|
final room=<String,dynamic>{'phase':'ARCADE','puzzles':[
|
|
{'id':'P01','solved':false,'delivered':false},
|
|
{'id':'P02A','solved':false,'delivered':false},
|
|
{'id':'P02B','solved':false,'delivered':false},
|
|
{'id':'P03','solved':false,'delivered':false},
|
|
{'id':'P04','solved':false,'delivered':false},
|
|
]};
|
|
Map<String,dynamic> hint(String target) => {'phase':'ARCADE','target':target,'condition':'incomplete'};
|
|
expect(hintReason(hint('P01'),room),isNotNull);
|
|
expect(hintReason(hint('P03'),room),isNotNull);
|
|
expect(hintReason(hint('P04'),room),isNotNull);
|
|
expect(hintReason(hint('P02A'),room),isNull);
|
|
(room['puzzles'] as List)[0]['solved']=true;
|
|
expect(hintReason(hint('P01'),room),isNull);
|
|
expect(hintReason(hint('P02A'),room),isNotNull);
|
|
expect(hintReason(hint('P02B'),room),isNull);
|
|
(room['puzzles'] as List)[1]['delivered']=true;
|
|
expect(hintReason(hint('P02B'),room),isNotNull);
|
|
room['phase']='CELLS';
|
|
expect(hintReason(hint('P03'),room),isNull);
|
|
expect(hintReason({'phase':'ALL','target':'room','condition':'any'},room),isNotNull);
|
|
});
|
|
test('cabinet first wins remove incomplete hints', () {
|
|
final room=<String,dynamic>{'phase':'ARCADE','stations':[{'id':'cabinet_01','won':false}]};
|
|
final hint=<String,dynamic>{'phase':'ALL','target':'cabinet_01','condition':'incomplete'};
|
|
expect(hintReason(hint,room),isNotNull);
|
|
(room['stations'] as List)[0]['won']=true;
|
|
expect(hintReason(hint,room),isNull);
|
|
});
|
|
}
|