Skip to content

Commit

Permalink
ci: updates coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
dresende committed Aug 16, 2024
1 parent 12454ad commit 2c7bd3a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/Features.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// eslint-disable-next-line no-unused-vars
import { resolve } from "path";
import should from "should";
import { Renderer } from "../index.js";

Expand All @@ -11,6 +12,13 @@ describe("Features", () => {
view({ name: "world" }).should.equal("<h3>\n\tHello world\n</h3>");
});

it("<% include %> can have another default extension", async () => {
const keikan = new Renderer({ extension: "ejs" });
const view = await keikan.compilePath(import.meta.dirname + "/views/has-include");

view().should.equal("<h3>Hello world</h3>");
});

it("<% include %> can be called with no arguments", async () => {
const view1 = await keikan.compileData("<% include test/views/label() %>");
const view2 = await keikan.compileData("<% include test/views/label() %>", { debug: false });
Expand Down Expand Up @@ -68,4 +76,16 @@ describe("Features", () => {

view().should.equal("<ul>\n\t<li>(odd) 1. 1 bar</li>\n\t<li>(even) 2. 2 foo</li>\n\t<li>(odd) 3. 3 bar</li>\n</ul>");
});

it("supports custom resolver", async () => {
const keikan = new Renderer({
debug : false,
resolver : (path, base = null) => {
return resolve(base, path + ".html");
},
});
const view = await keikan.compilePath(import.meta.dirname + "/views/has-include");

view({ name: "world" }).should.equal("<h3> \nHello world \n</h3>");
});
});
1 change: 1 addition & 0 deletions test/views/has-include.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<% include simple %>
1 change: 1 addition & 0 deletions test/views/simple.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h3>Hello world</h3>

0 comments on commit 2c7bd3a

Please sign in to comment.