56 lines
1.9 KiB
Dart
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',
|
|
);
|
|
});
|
|
});
|
|
}
|