Skip to content

Commit

Permalink
test: add base_locale_empty_string test
Browse files Browse the repository at this point in the history
  • Loading branch information
Tienisto committed Dec 1, 2024
1 parent bd9692d commit 244e7b1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions slang/test/unit/builder/translation_model_builder_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,22 @@ void main() {
});

group('Fallback', () {
test('base_locale_empty_string: Do not remove empty strings in base locale',
() {
final result = TranslationModelBuilder.build(
buildConfig: RawConfig.defaultConfig
.copyWith(
fallbackStrategy: FallbackStrategy.baseLocaleEmptyString,
)
.toBuildModelConfig(),
locale: _locale,
map: {'hello': ''},
);

expect(result.root.entries['hello'], isA<StringTextNode>());
expect((result.root.entries['hello'] as StringTextNode).content, '');
});

test('Should fallback context type cases', () {
final result = TranslationModelBuilder.build(
buildConfig: RawConfig.defaultConfig
Expand Down

0 comments on commit 244e7b1

Please sign in to comment.