Skip to content

Commit

Permalink
style: run format tool
Browse files Browse the repository at this point in the history
  • Loading branch information
nebrelbug committed Nov 30, 2023
1 parent 8054ffc commit 9fb7d49
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/file-handling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ export function resolvePath(
}

const baseFilePath = options && options.filepath;
const defaultExtension = this.config.defaultExtension === undefined ? ".eta" : this.config.defaultExtension;
const defaultExtension =
this.config.defaultExtension === undefined ? ".eta" : this.config.defaultExtension;

// how we index cached template paths
const cacheIndex = JSON.stringify({
Expand All @@ -49,7 +50,7 @@ export function resolvePath(
views: this.config.views,
});

templatePath += path.extname(templatePath) ? "" : defaultExtension;
templatePath += path.extname(templatePath) ? "" : defaultExtension;

// if the file was included from another template
if (baseFilePath) {
Expand Down
6 changes: 3 additions & 3 deletions test/file-handling.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe("file handling errors", () => {
});

describe("filepath default extension tests", () => {
console.log("Templates are in ", viewsDir)
console.log("Templates are in ", viewsDir);

it("works with defaultExtension", async () => {
const eta = new Eta({ views: viewsDir, cache: true, defaultExtension: ".tmpl" });
Expand All @@ -82,7 +82,7 @@ describe("filepath default extension tests", () => {
it("works with no extension", async () => {
const eta = new Eta({ views: viewsDir, cache: true, defaultExtension: "" });
const templateResult = await eta.render("template-without-extn", { name: "TMPL Run" });

expect(templateResult).toEqual(`Hi TMPL Run`);
});
})
});

0 comments on commit 9fb7d49

Please sign in to comment.