cyberhybridhub/server/test/questions_client_payload_test.dart
nathanAndrinoid 4459852f83
Some checks failed
Admin portal tests / test (push) Has been cancelled
spelling
2026-06-05 03:22:35 +00:00

56 lines
1.9 KiB
Dart

import 'package:cyberhybridhub_server/questions_db.dart';
import 'package:test/test.dart';
void main() {
group('QuestionsDb client presentation fields', () {
test('market_history prospective maps sourceId and presentation', () {
final Map<String, dynamic> question = <String, dynamic>{
'sourceTag': 'market_history:prospective',
'pipelineKey': 'trading',
};
expect(QuestionsDb.resolveSourceId(question), 'market_history');
expect(QuestionsDb.resolvePresentation(question), 'market_glyph_slider');
});
test('spelling word quiz maps sourceId and presentation', () {
final Map<String, dynamic> question = <String, dynamic>{
'sourceTag': 'spelling:word_quiz',
'pipelineKey': 'spelling',
'pipelineStep': 'spelling_word_quiz',
};
expect(QuestionsDb.resolveSourceId(question), 'spelling');
expect(QuestionsDb.resolvePresentation(question), 'spelling_word');
});
test('spelling follow-up uses slider presentation', () {
final Map<String, dynamic> question = <String, dynamic>{
'sourceTag': 'spelling:follow_up',
'pipelineKey': 'spelling',
'pipelineStep': 'spelling_follow_up',
};
expect(QuestionsDb.resolveSourceId(question), 'spelling');
expect(QuestionsDb.resolvePresentation(question), 'market_glyph_slider');
});
test('spelling pipeline key without step still maps to spelling_word', () {
final Map<String, dynamic> question = <String, dynamic>{
'pipelineKey': 'spelling',
};
expect(QuestionsDb.resolveSourceId(question), 'spelling');
expect(QuestionsDb.resolvePresentation(question), 'spelling_word');
});
test('missing metadata defaults to market presentation', () {
expect(QuestionsDb.resolveSourceId(<String, dynamic>{}), 'market_history');
expect(
QuestionsDb.resolvePresentation(<String, dynamic>{}),
'market_glyph_slider',
);
});
});
}