From d397b329a1a251e9ece81903c042ea1a51f29517 Mon Sep 17 00:00:00 2001 From: Bertrand Estellon <bertrand.estellon@univ-amu.fr> Date: Wed, 4 Dec 2024 18:27:11 +0100 Subject: [PATCH] Modification des tests du TD45 --- TD45/all.test.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/TD45/all.test.js b/TD45/all.test.js index 42cd0f6..a7f2883 100644 --- a/TD45/all.test.js +++ b/TD45/all.test.js @@ -8,13 +8,15 @@ import fs from 'fs'; import puppeteer from 'puppeteer'; let ServerGame = null; -let serverData = null; +let serverData = null; +let data = undefined; let Game = null; -let data = null; async function asyncImport() { if (progression >= 28) { Game = (await import('./static/game.js')).Game; + } + if (progression <= 47) { data = (await import('./static/data.js')).data; } if (progression >= 39) { @@ -69,11 +71,7 @@ if (progression >= 27) { const browser = await puppeteer.launch(); const page = await browser.newPage(); const consoleLogs = []; - page.on('console', async consoleObj => { - const line = await consoleObj.args()[0]?.jsonValue(); - if (line == undefined) return; - consoleLogs.push(line) - }); + page.on('console', async consoleObj => { consoleLogs.push(await consoleObj.args()[0]?.jsonValue()) }); await page.goto(`http://localhost:${fastify.server.address().port}`); const content = await page.content(); const dom = new JSDOM(content); @@ -99,7 +97,6 @@ if (progression >= 28 && progression < 30) { page.on('console', async consoleObj => { const args = consoleObj.args(); const arg0 = args[0]; - if (arg0 == undefined) return; const json = await arg0.jsonValue(); consoleLogs.push(json) }); @@ -126,7 +123,6 @@ if (progression == 29) { page.on('console', async consoleObj => { const args = consoleObj.args(); const arg0 = args[0]; - if (arg0 == undefined) return; const json = await arg0.jsonValue(); consoleLogs.push(json) }); -- GitLab