import { describe, it, expect } from "vitest"; import { syncFormattedMessage } from "./syncFormattedMessage"; describe("syncFormattedMessage", () => { it("updated false when given empty file and no translations", () => { expect( syncFormattedMessage({ fileContent: "", translations: {} }) ).toEqual({ updated: false }); }); it("updates components", () => { expect( syncFormattedMessage({ fileContent: '', translations: { myKey: "new message" }, }) ).toEqual({ updated: true, fileContent: '', }); }); it("updates multiline ", () => { expect( syncFormattedMessage({ fileContent: ``, translations: { myKey: "new message" }, }) ).toEqual({ updated: true, fileContent: ``, }); }); it("updates multiple components", () => { expect( syncFormattedMessage({ fileContent: '' + '', translations: { myKey: "new message", anotherKey: "another new message", }, }) ).toEqual({ updated: true, fileContent: '' + '', }); }); it("updates nothing if no key was found", () => { expect( syncFormattedMessage({ fileContent: '' + '', translations: { unusedKey: "new message", }, }) ).toEqual({ updated: false, }); }); });