Skip to content

Commit a7ebd61

Browse files
committed
fix(cli): add test for REGION block preservation in push output
1 parent bb15da3 commit a7ebd61

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2737,6 +2737,36 @@ Hello world!
27372737

27382738
expect(data).toEqual({ "0#0-1#": "Hello world!" });
27392739
});
2740+
2741+
it("should preserve REGION blocks in push output", async () => {
2742+
setupFileMocks();
2743+
2744+
const input = `
2745+
WEBVTT
2746+
2747+
REGION
2748+
id:sidebar
2749+
width:30%
2750+
lines:3
2751+
2752+
00:00:00.000 --> 00:00:01.000
2753+
Hello world!
2754+
`.trim();
2755+
2756+
mockFileOperations(input);
2757+
2758+
const vttLoader = createBucketLoader("vtt", "i18n/[locale].vtt", {
2759+
defaultLocale: "en",
2760+
});
2761+
vttLoader.setDefaultLocale("en");
2762+
await vttLoader.pull("en");
2763+
await vttLoader.push("es", { "0#0-1#": "¡Hola mundo!" });
2764+
2765+
const written = (fs.writeFile as any).mock.calls[0][1] as string;
2766+
expect(written).toContain("REGION");
2767+
expect(written).toContain("id:sidebar");
2768+
expect(written).toContain("¡Hola mundo!");
2769+
});
27402770
});
27412771

27422772
describe("XML bucket loader", () => {

0 commit comments

Comments
 (0)