Fix Biome warnings
This commit is contained in:
Vendored
+655
-655
File diff suppressed because it is too large
Load Diff
+20
-20
@@ -1,29 +1,29 @@
|
||||
CookieCode.configurer({
|
||||
sortie: "#app",
|
||||
afficherNotions: true,
|
||||
sortie: "#app",
|
||||
afficherNotions: true,
|
||||
});
|
||||
|
||||
const recette = CookieCode.recette("Cookie au chocolat")
|
||||
.prendre("farine", 200, "g")
|
||||
.prendre("sucre", 100, "g")
|
||||
.prendre("chocolat", 150, "g")
|
||||
.utiliser("saladier")
|
||||
.ajouter("farine")
|
||||
.ajouter("sucre")
|
||||
.ajouter("chocolat")
|
||||
.melanger()
|
||||
.repeter(2, (recette) => {
|
||||
recette.melanger();
|
||||
})
|
||||
.cuire(12, "minutes")
|
||||
.servir();
|
||||
.prendre("farine", 200, "g")
|
||||
.prendre("sucre", 100, "g")
|
||||
.prendre("chocolat", 150, "g")
|
||||
.utiliser("saladier")
|
||||
.ajouter("farine")
|
||||
.ajouter("sucre")
|
||||
.ajouter("chocolat")
|
||||
.melanger()
|
||||
.repeter(2, (recette) => {
|
||||
recette.melanger();
|
||||
})
|
||||
.cuire(12, "minutes")
|
||||
.servir();
|
||||
|
||||
const defi = CookieCode.defi("Cookie avec boucle", {
|
||||
ingredientsMinimum: 3,
|
||||
actionsObligatoires: ["melanger", "cuire", "servir"],
|
||||
boucleObligatoire: true,
|
||||
terminerParServir: true,
|
||||
interdireErreurs: true
|
||||
ingredientsMinimum: 3,
|
||||
actionsObligatoires: ["melanger", "cuire", "servir"],
|
||||
boucleObligatoire: true,
|
||||
terminerParServir: true,
|
||||
interdireErreurs: true,
|
||||
});
|
||||
|
||||
console.log(CookieCode.verifier(recette, defi).toText());
|
||||
|
||||
+16
-16
@@ -1,18 +1,18 @@
|
||||
{
|
||||
"name": "cookiecode",
|
||||
"version": "0.2.0",
|
||||
"description": "Microlibrairie educative pour apprendre l'algorithmique avec des recettes de cuisine.",
|
||||
"main": "dist/cookiecode.js",
|
||||
"scripts": {
|
||||
"test": "node test/cookiecode.test.js",
|
||||
"build": "cp src/cookiecode.js dist/cookiecode.js"
|
||||
},
|
||||
"keywords": [
|
||||
"education",
|
||||
"algorithmique",
|
||||
"cuisine",
|
||||
"javascript",
|
||||
"cdn"
|
||||
],
|
||||
"license": "MIT"
|
||||
"name": "cookiecode",
|
||||
"version": "0.2.0",
|
||||
"description": "Microlibrairie educative pour apprendre l'algorithmique avec des recettes de cuisine.",
|
||||
"main": "dist/cookiecode.js",
|
||||
"scripts": {
|
||||
"test": "node test/cookiecode.test.js",
|
||||
"build": "cp src/cookiecode.js dist/cookiecode.js"
|
||||
},
|
||||
"keywords": [
|
||||
"education",
|
||||
"algorithmique",
|
||||
"cuisine",
|
||||
"javascript",
|
||||
"cdn"
|
||||
],
|
||||
"license": "MIT"
|
||||
}
|
||||
|
||||
+655
-655
File diff suppressed because it is too large
Load Diff
+55
-43
@@ -1,19 +1,19 @@
|
||||
const assert = require("assert");
|
||||
const assert = require("node:assert");
|
||||
const CookieCode = require("../dist/cookiecode.js");
|
||||
|
||||
CookieCode.configurer({ sortie: "test", afficherNotions: true });
|
||||
|
||||
const texteRecette = CookieCode.recette("Cookie au chocolat")
|
||||
.prendre("farine", 200, "g")
|
||||
.prendre("sucre", 100, "g")
|
||||
.utiliser("saladier")
|
||||
.ajouter("farine")
|
||||
.melanger()
|
||||
.repeter(2, (recette) => {
|
||||
recette.melanger();
|
||||
})
|
||||
.cuire(12, "minutes")
|
||||
.toText();
|
||||
.prendre("farine", 200, "g")
|
||||
.prendre("sucre", 100, "g")
|
||||
.utiliser("saladier")
|
||||
.ajouter("farine")
|
||||
.melanger()
|
||||
.repeter(2, (recette) => {
|
||||
recette.melanger();
|
||||
})
|
||||
.cuire(12, "minutes")
|
||||
.toText();
|
||||
|
||||
assert.match(texteRecette, /Recette : Cookie au chocolat/);
|
||||
assert.match(texteRecette, /1\. Prendre 200 g de farine\./);
|
||||
@@ -27,21 +27,21 @@ assert.match(texteRecette, /Repeter = boucle/);
|
||||
|
||||
const pate = CookieCode.preparation("pate").definir("texture", "trop seche");
|
||||
const texteCondition = CookieCode.recette("Pate a cookies")
|
||||
.si(
|
||||
() => pate.est("trop seche"),
|
||||
(recette) => {
|
||||
recette.ajouter("lait", 20, "ml");
|
||||
},
|
||||
)
|
||||
.toText();
|
||||
.si(
|
||||
() => pate.est("trop seche"),
|
||||
(recette) => {
|
||||
recette.ajouter("lait", 20, "ml");
|
||||
},
|
||||
)
|
||||
.toText();
|
||||
|
||||
assert.match(texteCondition, /Si condition fournie :/);
|
||||
assert.match(texteCondition, /1\.1\. Ajouter 20 ml de lait\./);
|
||||
assert.match(texteCondition, /Si = condition/);
|
||||
|
||||
const html = CookieCode.recette("<script>alert('xss')</script>")
|
||||
.ajouter("<img src=x onerror=alert(1)>")
|
||||
.toHTML();
|
||||
.ajouter("<img src=x onerror=alert(1)>")
|
||||
.toHTML();
|
||||
|
||||
assert.ok(!html.includes("<script>alert"));
|
||||
assert.ok(!html.includes("<img src=x"));
|
||||
@@ -49,18 +49,18 @@ assert.ok(html.includes("<script>alert"));
|
||||
assert.ok(html.includes("<img src=x"));
|
||||
|
||||
const recetteDefi = CookieCode.recette("Cookie defi")
|
||||
.prendre("farine", 200, "g")
|
||||
.prendre("sucre", 100, "g")
|
||||
.prendre("chocolat", 150, "g")
|
||||
.ajouter("farine")
|
||||
.ajouter("sucre")
|
||||
.ajouter("chocolat")
|
||||
.melanger()
|
||||
.repeter(2, (recette) => {
|
||||
recette.melanger();
|
||||
})
|
||||
.cuire(12, "minutes")
|
||||
.servir();
|
||||
.prendre("farine", 200, "g")
|
||||
.prendre("sucre", 100, "g")
|
||||
.prendre("chocolat", 150, "g")
|
||||
.ajouter("farine")
|
||||
.ajouter("sucre")
|
||||
.ajouter("chocolat")
|
||||
.melanger()
|
||||
.repeter(2, (recette) => {
|
||||
recette.melanger();
|
||||
})
|
||||
.cuire(12, "minutes")
|
||||
.servir();
|
||||
|
||||
const rapport = recetteDefi.analyser();
|
||||
assert.deepStrictEqual(rapport.ingredients, ["farine", "sucre", "chocolat"]);
|
||||
@@ -70,11 +70,11 @@ assert.strictEqual(rapport.termineParServir, true);
|
||||
assert.deepStrictEqual(rapport.erreurs, []);
|
||||
|
||||
const defiCookie = CookieCode.defi("Cookie avec boucle", {
|
||||
ingredientsMinimum: 3,
|
||||
actionsObligatoires: ["melanger", "cuire", "servir"],
|
||||
boucleObligatoire: true,
|
||||
terminerParServir: true,
|
||||
interdireErreurs: true,
|
||||
ingredientsMinimum: 3,
|
||||
actionsObligatoires: ["melanger", "cuire", "servir"],
|
||||
boucleObligatoire: true,
|
||||
terminerParServir: true,
|
||||
interdireErreurs: true,
|
||||
});
|
||||
|
||||
const verification = CookieCode.verifier(recetteDefi, defiCookie);
|
||||
@@ -83,14 +83,26 @@ assert.match(verification.toText(), /Resultat : reussi/);
|
||||
assert.match(verification.toText(), /✅ Tu as utilise 3 ingredient\(s\)\./);
|
||||
|
||||
const recetteIncomplete = CookieCode.recette("Cookie incomplet")
|
||||
.prendre("farine", 200, "g")
|
||||
.melanger();
|
||||
.prendre("farine", 200, "g")
|
||||
.melanger();
|
||||
|
||||
const verificationIncomplete = CookieCode.verifier(recetteIncomplete, defiCookie);
|
||||
const verificationIncomplete = CookieCode.verifier(
|
||||
recetteIncomplete,
|
||||
defiCookie,
|
||||
);
|
||||
assert.strictEqual(verificationIncomplete.reussi, false);
|
||||
assert.match(verificationIncomplete.toText(), /❌ Il faut au moins 3 ingredient\(s\)\./);
|
||||
assert.match(verificationIncomplete.toText(), /❌ Il manque une boucle : essaie avec \.repeter\(\)\./);
|
||||
assert.match(verificationIncomplete.toText(), /❌ Ta recette doit se terminer par \.servir\(\)\./);
|
||||
assert.match(
|
||||
verificationIncomplete.toText(),
|
||||
/❌ Il faut au moins 3 ingredient\(s\)\./,
|
||||
);
|
||||
assert.match(
|
||||
verificationIncomplete.toText(),
|
||||
/❌ Il manque une boucle : essaie avec \.repeter\(\)\./,
|
||||
);
|
||||
assert.match(
|
||||
verificationIncomplete.toText(),
|
||||
/❌ Ta recette doit se terminer par \.servir\(\)\./,
|
||||
);
|
||||
|
||||
assert.strictEqual(CookieCode.version, "0.2.0");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user