From 244e7b1b5084653a01b40c746fe2c349009666d7 Mon Sep 17 00:00:00 2001 From: Tien Do Nam Date: Sun, 1 Dec 2024 18:58:19 +0100 Subject: [PATCH] test: add base_locale_empty_string test --- .../builder/translation_model_builder_test.dart | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/slang/test/unit/builder/translation_model_builder_test.dart b/slang/test/unit/builder/translation_model_builder_test.dart index 95d9d5d..0d7e7d6 100644 --- a/slang/test/unit/builder/translation_model_builder_test.dart +++ b/slang/test/unit/builder/translation_model_builder_test.dart @@ -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()); + expect((result.root.entries['hello'] as StringTextNode).content, ''); + }); + test('Should fallback context type cases', () { final result = TranslationModelBuilder.build( buildConfig: RawConfig.defaultConfig