-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
62 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
src/ | ||
tsconfig.json | ||
test/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// app.js | ||
|
||
alert("Hello, World!"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[ | ||
{ | ||
"title": "My New Blog", | ||
"date": "2020-5-6", | ||
"text": "This is my new blog where I talk about cats!" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<h1><%= message %></h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// style.scss | ||
|
||
h1{ | ||
color: red; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const path = require("path"); | ||
const staticSiteGenerator = require("../dist"); | ||
|
||
const data = staticSiteGenerator.getData(); | ||
|
||
staticSiteGenerator.log.info("starting tests..."); | ||
|
||
if(data.css.style !== "h1{color:red}\n"){ | ||
staticSiteGenerator.log.error("SCSS failed"); | ||
process.exit(-1); | ||
}else{ | ||
staticSiteGenerator.log.success("SCSS passed"); | ||
} | ||
|
||
if(data.js.app === "alert(\"Hello, World!\");\n"){ | ||
staticSiteGenerator.log.error("TypeScript failed"); | ||
process.exit(-1); | ||
}else{ | ||
staticSiteGenerator.log.success("TypeScript passed"); | ||
} | ||
|
||
if(data.blog[0].date === "2020-5-6\n"){ | ||
staticSiteGenerator.log.error("JSON failed"); | ||
process.exit(-1); | ||
}else{ | ||
staticSiteGenerator.log.success("JSON passed"); | ||
} | ||
|
||
staticSiteGenerator.renderPage(path.join(staticSiteGenerator.options.srcDir, "index.ejs"), {message: "Hello, World!"}, (html) => { | ||
if(html === "<h1>Hello, World!</h1>\n"){ | ||
staticSiteGenerator.log.error("EJS failed"); | ||
process.exit(-1); | ||
}else{ | ||
staticSiteGenerator.log.success("EJS passed"); | ||
} | ||
}); | ||
|
||
staticSiteGenerator.log.success("all tests passed!"); |