Skip to content

Commit

Permalink
test: add missing argument
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelstroschein committed Sep 7, 2024
1 parent 988aa28 commit a59f6ef
Showing 1 changed file with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -275,19 +275,17 @@ test("plugin calls that use fs should be intercepted to use an absolute path", a
process.cwd = () => "/";

const mockRepo = {
"/inlang/development-projects/inlang-nextjs/app/i18n/locales/en.json":
JSON.stringify({
key1: "value1",
key2: "value2",
}),
"/inlang/development-projects/inlang-nextjs/other-folder/backend.inlang/settings.json":
JSON.stringify({
baseLocale: "en",
locales: ["en", "de"],
"plugin.mock-plugin": {
pathPattern: "./../../app/i18n/locales/{locale}.json",
},
} satisfies ProjectSettings),
"/messages/en.json": JSON.stringify({
key1: "value1",
key2: "value2",
}),
"/project.inlang/settings.json": JSON.stringify({
baseLocale: "en",
locales: ["en", "de"],
"plugin.mock-plugin": {
pathPattern: "./messages/{locale}.json",
},
} satisfies ProjectSettings),
};

const mockPlugin: InlangPlugin = {
Expand Down Expand Up @@ -348,12 +346,12 @@ test("plugin calls that use fs should be intercepted to use an absolute path", a

const project = await loadProjectFromDirectoryInMemory({
fs: fs as any,
path: "/inlang/development-projects/inlang-nextjs/other-folder/backend.inlang",
path: "/project.inlang",
providePlugins: [mockPlugin],
});

expect(loadMessagesSpy).toHaveBeenCalled();
expect(fsReadFileSpy).toHaveBeenCalledWith("/messages/en.json");
expect(fsReadFileSpy).toHaveBeenCalledWith("/messages/en.json", undefined);

// todo test that saveMessages works too.
// await project.db.insertInto("bundle").defaultValues().execute();
Expand Down

0 comments on commit a59f6ef

Please sign in to comment.