Skip to content

Commit

Permalink
add unit tests with mocha
Browse files Browse the repository at this point in the history
fix some cow templates and word wrapping algorithm
  • Loading branch information
erincones committed Mar 31, 2021
1 parent 99115c6 commit 9f2a598
Show file tree
Hide file tree
Showing 36 changed files with 1,466 additions and 145 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Dependencies
# dependencies
node_modules/
6 changes: 6 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
"@typescript-eslint/semi": "error",
"@typescript-eslint/quotes": [ "error", "backtick" ]
}
},
{
"files": [ "test/**/*" ],
"env": {
"mocha": true
}
}
]
}
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Dependencies
# dependencies
node_modules/

# Packs
# .env file
.env

# packs
*.tgz
2 changes: 1 addition & 1 deletion cli/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function getArg(token, j, argv, i) {
*/
function printHelp() {
// Version
var version = "0.2.1";
var version = "0.3.0";

// Get current script
var script = process.argv[1].replace(/\\/g, "/");
Expand Down
2 changes: 1 addition & 1 deletion cows/blowfish.cow.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function render(action) {
" |/`. `-. `._)\n" +
" / .-.\\\n" +
" VK \\ ( `\\\n" +
" `.\\"
" `.\\\n"
);
}

Expand Down
2 changes: 1 addition & 1 deletion cows/bong.cow.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function render(action, eyes) {
return (
" " + a + "\n" +
" " + a + "\n" +
" ^__^\n" +
" ^__^ \n" +
" _______/(" + e + ")\n" +
"/\\/( /(__)\n" +
" | W----|| |~|\n" +
Expand Down
4 changes: 2 additions & 2 deletions cows/cower.cow.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ function render(action) {
return (
" " + a + "\n" +
" " + a + "\n" +
" ,__, | |\n" +
" ,__, | | \n" +
" (oo)\\| |___\n" +
" (__)\\| | )\\_\n" +
" | |_w | \\\n" +
" | | || *\n" +
" | | || *\n\n" +
" Cower...."
);
}
Expand Down
6 changes: 3 additions & 3 deletions cows/dragon.cow.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ function render(action) {
return (
" " + a + " / \\ //\\\n" +
" " + a + " |\\___/| / \\// \\\\\n" +
" /0 0 \\__ / // | \\ \\\n" +
" / / \\/_/ // | \\ \\\n" +
" @_^_@'/ \\/_ // | \\ \\\n" +
" /0 0 \\__ / // | \\ \\ \n" +
" / / \\/_/ // | \\ \\ \n" +
" @_^_@'/ \\/_ // | \\ \\ \n" +
" //_^_/ \\/_ // | \\ \\\n" +
" ( //) | \\/// | \\ \\\n" +
" ( / /) _|_ / ) // | \\ _\\\n" +
Expand Down
10 changes: 5 additions & 5 deletions cows/elephant-in-snake.cow.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ function render(action) {

return (
" " + a + "\n" +
" " + a + " ....\n" +
" ........ .\n" +
" . .\n" +
" . .\n" +
" " + a + " .... \n" +
" ........ . \n" +
" . . \n" +
" . . \n" +
"......... .......\n" +
"..............................\n" +
"..............................\n\n" +
"Elephant inside ASCII snake"
);
}
Expand Down
10 changes: 5 additions & 5 deletions cows/elephant.cow.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ function render(action) {
" " + a + " // \\/ \\/ \\\\\n" +
" (( O O ))\n" +
" \\\\ / \\ //\n" +
" \\/ | | \\/\n" +
" | | | |\n" +
" | | | |\n" +
" | o |\n" +
" | | | |\n" +
" \\/ | | \\/ \n" +
" | | | | \n" +
" | | | | \n" +
" | o | \n" +
" | | | | \n" +
" |m| |m| "
);
}
Expand Down
12 changes: 6 additions & 6 deletions cows/eyes.cow.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ function render(action) {
" " + a + "\n" +
" .::!!!!!!!:.\n" +
" .!!!!!:. .:!!!!!!!!!!!!\n" +
" ~~~~!!!!!!. .:!!!!!!!!!UWWW$$$\n" +
" :$$NWX!!: .:!!!!!!XUWW$$$$$$$$$P\n" +
" $$$$$##WX!: .<!!!!UW$$$$\" $$$$$$$$#\n" +
" $$$$$ $$$UX :!!UW$$$$$$$$$ 4$$$$$*\n" +
" ^$$$B $$$$\\ $$$$$$$$$$$$ d$$R\"\n" +
" \"*$bd$$$$ '*$$$$$$$$$$$o+#\"\n" +
" ~~~~!!!!!!. .:!!!!!!!!!UWWW$$$ \n" +
" :$$NWX!!: .:!!!!!!XUWW$$$$$$$$$P \n" +
" $$$$$##WX!: .<!!!!UW$$$$\" $$$$$$$$# \n" +
" $$$$$ $$$UX :!!UW$$$$$$$$$ 4$$$$$* \n" +
" ^$$$B $$$$\\ $$$$$$$$$$$$ d$$R\" \n" +
" \"*$bd$$$$ '*$$$$$$$$$$$o+#\" \n" +
" \"\"\"\" \"\"\"\"\"\"\" "
);
}
Expand Down
21 changes: 11 additions & 10 deletions cows/flaming-sheep.cow.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@ var fix = require("./fix");


/** @type {import(".").CowRenderer} */
function render(action) {
function render(action, eyes) {
var a = fix.fixAction(action);
var e = fix.fixFace(eyes, "oo");

return (
" " + a + " . . .\n" +
" " + a + " . . . ` ,\n" +
" " + a + " .; . : .' : : : .\n" +
" " + a + " i..`: i` i.i.,i i .\n" +
" " + a + " `,--.|i |i|ii|ii|i:\n" +
" U${eyes}U\\.'@@@@@@`.||'\n" +
" \\__/(@@@@@@@@@@)'\n" +
" (@@@@@@@@)\n" +
" `YY~~~~YY'\n" +
" " + a + " . . . \n" +
" " + a + " . . . ` , \n" +
" " + a + " .; . : .' : : : . \n" +
" " + a + " i..`: i` i.i.,i i . \n" +
" " + a + " `,--.|i |i|ii|ii|i: \n" +
" U" + e + "U\\.'@@@@@@`.||' \n" +
" \\__/(@@@@@@@@@@)' \n" +
" (@@@@@@@@) \n" +
" `YY~~~~YY' \n" +
" || || "
);
}
Expand Down
4 changes: 2 additions & 2 deletions cows/koala.cow.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ function render(action) {
return (
" " + a + "\n" +
" " + a + "\n" +
" ___\n" +
" ___ \n" +
" {~._.~}\n" +
" ( Y )\n" +
" ()~*~()\n" +
" ()~*~() \n" +
" (_)-(_) "
);
}
Expand Down
2 changes: 1 addition & 1 deletion cows/kosh.cow.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function render(action) {
" ___ _____ ___\n" +
" / \\ / /| / \\\n" +
"| | / / | | |\n" +
"| | /____/ | | |\n" +
"| | /____/ | | | \n" +
"| | | | | | |\n" +
"| | | {} | / | |\n" +
"| | |____|/ | |\n" +
Expand Down
10 changes: 5 additions & 5 deletions cows/luke-koala.cow.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ function render(action) {
" " + a + "\n" +
" " + a + " .\n" +
" ___ //\n" +
" {~._.~}//\n" +
" ( Y )K/\n" +
" ()~*~()\n" +
" (_)-(_)\n" +
" Luke\n" +
" {~._.~}// \n" +
" ( Y )K/ \n" +
" ()~*~() \n" +
" (_)-(_) \n" +
" Luke \n" +
" Sywalker\n" +
" koala "
);
Expand Down
6 changes: 3 additions & 3 deletions cows/milk.cow.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function render(action) {
var a = fix.fixAction(action);

return (
" " + a + " ____________\n" +
" " + a + " ____________ \n" +
" " + a + " |__________|\n" +
" / /\\\n" +
" / / \\\n" +
Expand All @@ -21,8 +21,8 @@ function render(action) {
" / | \\_____/ | / /\n" +
" / /| | / /|\n" +
"/||\\| | /||\\/\n" +
" -------------|\n" +
" | | | |\n" +
" -------------| \n" +
" | | | | \n" +
" <__/ \\__>"
);
}
Expand Down
2 changes: 1 addition & 1 deletion cows/moofasa.cow.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function render(action, eyes) {
" | (" + e + ") |______\n" +
" | (__) | )\\/\\\n" +
" \\____/|----w |\n" +
" || ||\n" +
" || ||\n\n" +
" Moofasa"
);
}
Expand Down
22 changes: 11 additions & 11 deletions cows/ren.cow.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ function render(action) {
return (
" " + a + "\n" +
" " + a + "\n" +
" ____\n" +
" ____ \n" +
" /# /_\\_\n" +
" | |/o\\o\\\n" +
" | \\\\_/_/\n" +
" / |_ |\n" +
"| ||\\_ ~|\n" +
"| ||| \\/\n" +
"| |||_\n" +
" \\// |\n" +
" || |\n" +
" ||_ \\\n" +
" \\_| o|\n" +
" /\\___/\n" +
" / ||||__\n" +
" / |_ | \n" +
"| ||\\_ ~| \n" +
"| ||| \\/ \n" +
"| |||_ \n" +
" \\// | \n" +
" || | \n" +
" ||_ \\ \n" +
" \\_| o| \n" +
" /\\___/ \n" +
" / ||||__ \n" +
" (___)_)"
);
}
Expand Down
10 changes: 5 additions & 5 deletions cows/satanic.cow.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ function render(action) {

return (
" " + a + "\n" +
" " + a + " (__)\n" +
" (\\/)\n" +
" /-------\\/\n" +
" / | 666 ||\n" +
"* ||----||\n" +
" " + a + " (__) \n" +
" (\\/) \n" +
" /-------\\/ \n" +
" / | 666 || \n" +
"* ||----|| \n" +
" ~~ ~~ "
);
}
Expand Down
2 changes: 1 addition & 1 deletion cows/sheep.cow.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function render(action, eyes) {
return (
" " + a + "\n" +
" " + a + "\n" +
" __\n" +
" __ \n" +
" U" + e + "U\\.'@@@@@@`.\n" +
" \\__/(@@@@@@@@@@)\n" +
" (@@@@@@@@)\n" +
Expand Down
4 changes: 2 additions & 2 deletions cows/skeleton.cow.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ function render(action, eyes) {
var e = fix.fixFace(eyes, "oo");

return (
" " + a + " (__)\n" +
" " + a + " /" + e + "|\n" +
" " + a + " (__) \n" +
" " + a + " /" + e + "| \n" +
" " + a + " (_\"_)*+++++++++*\n" +
" //I#\\\\\\\\\\\\\\\\I\\\n" +
" I[I|I|||||I I `\n" +
Expand Down
2 changes: 1 addition & 1 deletion cows/small.cow.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var fix = require("./fix");
/** @type {import(".").CowRenderer} */
function render(action, eyes, tongue) {
var a = fix.fixAction(action);
var e = fix.fixFace(eyes, typeof tongue === "string" ? "oo" : "..") || "..";
var e = fix.fixFace(eyes, "oo");
var t = fix.fixFace(tongue, " ");

return (
Expand Down
8 changes: 4 additions & 4 deletions cows/stegosaurus.cow.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ function render(action) {

return (
a + " . .\n" +
" " + a + " / `. .' \"\n" +
" " + a + " / `. .' \" \n" +
" " + a + " .---. < > < > .---.\n" +
" " + a + " | \\ \\ - ~ ~ - / / |\n" +
" _____ ..-~ ~-..-~\n" +
" | | \\~~~\\.' `./~~~/\n" +
" --------- \\__/ \\__/\n" +
" .' O \\ / / \\ \"\n" +
" .' O \\ / / \\ \" \n" +
" (_____, `._.' | } \\/~~~/\n" +
" `----. / } | / \\__/\n" +
" `-. | / | / `. ,~~|\n" +
" ~-.__| /_ - ~ ^| /- _ `..-'\n" +
" ~-.__| /_ - ~ ^| /- _ `..-' \n" +
" | / | / ~-. `-. _ _ _\n" +
" |_____| |_____| ~ - . _ _ _ _ _>`"
" |_____| |_____| ~ - . _ _ _ _ _>"
);
}

Expand Down
18 changes: 9 additions & 9 deletions cows/stimpy.cow.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ function render(action) {
var a = fix.fixAction(action);

return (
" " + a + " . _ .\n" +
" " + a + " |\\_|/__/|\n" +
" / / \\/ \\ \\\n" +
" /__|O||O|__ \\\n" +
" |/_ \\_/\\_/ _\\ |\n" +
" | | (____) | ||\n" +
" \\/\\___/\\__/ //\n" +
" " + a + " . _ . \n" +
" " + a + " |\\_|/__/| \n" +
" / / \\/ \\ \\ \n" +
" /__|O||O|__ \\ \n" +
" |/_ \\_/\\_/ _\\ | \n" +
" | | (____) | || \n" +
" \\/\\___/\\__/ // \n" +
" (_/ ||\n" +
" | ||\n" +
" | ||\\\n" +
" \\ //_/\n" +
" | ||\\ \n" +
" \\ //_/ \n" +
" \\______//\n" +
" __ || __||\n" +
" (____(____)"
Expand Down
Loading

0 comments on commit 9f2a598

Please sign in to comment.