Skip to content

Commit

Permalink
Write test for checking if the choices object are well formated and c…
Browse files Browse the repository at this point in the history
…heck if choices array is at the same level than template folder
  • Loading branch information
luctst committed Jul 31, 2019
1 parent f3861e2 commit 456e173
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
import test from "ava";
import choices from "../lib/utils/choices";
import {readdirSync} from "fs";

test("Repo-template fake test :)", t => {
t.pass();
test.serial("Choices array is correct ?", t => {
choices.map(el => {
t.truthy(el.name);
t.truthy(el.description);
t.truthy(el.templateName);
});
});

test.serial("Check if the choices array is at the same level than template folder", t => {
const checkIfTemplate = Object.values(choices).map(el => el.templateName);

readdirSync("./lib/template/").map(el => {
checkIfTemplate.includes(el) ? t.pass("Same level") : t.fail("Error, check if choices hold one objet per files in template folder");
});
});

0 comments on commit 456e173

Please sign in to comment.