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 question = { '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 question = { '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 question = { '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 question = { 'pipelineKey': 'spelling', }; expect(QuestionsDb.resolveSourceId(question), 'spelling'); expect(QuestionsDb.resolvePresentation(question), 'spelling_word'); }); test('missing metadata defaults to market presentation', () { expect(QuestionsDb.resolveSourceId({}), 'market_history'); expect( QuestionsDb.resolvePresentation({}), 'market_glyph_slider', ); }); }); }