From 456e17334456693699c5b55cbc3d40b9baa03316 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Tost=C3=A9e?= Date: Thu, 1 Aug 2019 00:26:20 +0200 Subject: [PATCH] Write test for checking if the choices object are well formated and check if choices array is at the same level than template folder --- test/test.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/test/test.js b/test/test.js index 65b7239..b23fff4 100644 --- a/test/test.js +++ b/test/test.js @@ -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"); + }); });