Skip to content

Commit 40137d0

Browse files
committed
feat: shoudTranslate
1 parent fe6f1c3 commit 40137d0

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

packages/cli/src/cli/loaders/index.spec.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,6 @@ user.password=Contraseña
10701070
it("should respect shouldTranslate: false flag", async () => {
10711071
setupFileMocks();
10721072

1073-
// Create input with a key that has shouldTranslate: false
10741073
const input = `{
10751074
"sourceLanguage": "en",
10761075
"strings": {
@@ -1104,13 +1103,11 @@ user.password=Contraseña
11041103
const xcodeXcstringsLoader = createBucketLoader("xcode-xcstrings", "i18n/[locale].xcstrings", { isCacheRestore: false, defaultLocale: "en" });
11051104
xcodeXcstringsLoader.setDefaultLocale("en");
11061105

1107-
// Pull data and verify that the shouldTranslate: false entry is skipped
11081106
const data = await xcodeXcstringsLoader.pull("en");
11091107

11101108
expect(data).toHaveProperty("normal_key", "This should be translated");
11111109
expect(data).not.toHaveProperty("do_not_translate");
11121110

1113-
// Now push a translation for the normal key
11141111
const payload = {
11151112
"normal_key": "Ceci devrait être traduit"
11161113
};
@@ -1121,22 +1118,15 @@ user.password=Contraseña
11211118
const writeFileCall = (fs.writeFile as any).mock.calls[0];
11221119
const writtenContent = JSON.parse(writeFileCall[1]);
11231120

1124-
// Verify that the normal key was translated
11251121
expect(writtenContent.strings.normal_key.localizations.fr.stringUnit.value).toBe("Ceci devrait être traduit");
1126-
1127-
// Verify that the do_not_translate key was preserved with its shouldTranslate: false flag
11281122
expect(writtenContent.strings.do_not_translate).toHaveProperty("shouldTranslate", false);
1129-
1130-
// Check that the do_not_translate key has no localizations for the target language
11311123
expect(writtenContent.strings.do_not_translate.localizations).not.toHaveProperty("fr");
11321124

1133-
// Now also test pushing with empty {} content to verify the flag is still preserved
11341125
await xcodeXcstringsLoader.push("fr", {});
11351126

11361127
const secondWriteFileCall = (fs.writeFile as any).mock.calls[1];
11371128
const secondWrittenContent = JSON.parse(secondWriteFileCall[1]);
11381129

1139-
// Verify the flag is still there
11401130
expect(secondWrittenContent.strings.do_not_translate).toHaveProperty("shouldTranslate", false);
11411131
});
11421132
});

0 commit comments

Comments
 (0)