From 939edb961fdd06e6d2dc14b2dbd6fc194ca61f55 Mon Sep 17 00:00:00 2001 From: Fabien Schurter Date: Mon, 6 May 2024 13:42:06 +0200 Subject: [PATCH] style: Revamp multi-line strings --- tests/adapter/pug.test.js | 2 +- tests/domain/helpers.test.js | 3 ++- tests/domain/i18n.test.js | 6 ++++-- tests/main.test.js | 12 ++++++++---- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/tests/adapter/pug.test.js b/tests/adapter/pug.test.js index 81f8b15..e801f7a 100644 --- a/tests/adapter/pug.test.js +++ b/tests/adapter/pug.test.js @@ -18,7 +18,7 @@ doctype html html body p Hello, #{name} #{surname}. -`) + `) const result = await ( renderTemplate(renderPug, readFile)(templateBasePath, { diff --git a/tests/domain/helpers.test.js b/tests/domain/helpers.test.js index 4e8f696..d78b516 100644 --- a/tests/domain/helpers.test.js +++ b/tests/domain/helpers.test.js @@ -14,11 +14,12 @@ describe('#src/domain/helpers', () => { const filePath = join(srcDirPath, 'helpers.mjs') await fs.mkdir(srcDirPath) + await fs.writeFile(filePath, ` export const sayHello = () => 'Hello World!' export const add2 = (num) => num + 2 -`) + `) const helpers = await importCustomHelpers(withDir(srcDirPath), ifPathExists) diff --git a/tests/domain/i18n.test.js b/tests/domain/i18n.test.js index 98fd23b..6e2064e 100644 --- a/tests/domain/i18n.test.js +++ b/tests/domain/i18n.test.js @@ -18,6 +18,7 @@ describe('#src/domain/i18n', () => { const file2Path = join(translationDirPath, 'en.json') await fs.mkdir(translationDirPath, { recursive: true }) + await fs.writeFile(file1Path, ` { "greetings": "Bonjour", @@ -31,7 +32,8 @@ describe('#src/domain/i18n', () => { ] } } -`) + `) + await fs.writeFile(file2Path, ` { "greetings": "Hello", @@ -45,7 +47,7 @@ describe('#src/domain/i18n', () => { ] } } -`) + `) const _parseProjectTranslations = ( parseProjectTranslations( diff --git a/tests/main.test.js b/tests/main.test.js index 58bace0..b8d0012 100644 --- a/tests/main.test.js +++ b/tests/main.test.js @@ -43,7 +43,8 @@ describe('#src/main', () => { "city": "%SECRET_CITY%" } } -`) + `) + await fs.writeFile(transFilePath, ` { "greetings": "Hello", @@ -53,10 +54,12 @@ describe('#src/main', () => { "fireman": "firefighter" } } -`) + `) + await fs.writeFile(helpersFilePath, ` export const toUpperCase = (str) => str.toUpperCase() -`) + `) + await fs.writeFile(indexTemplatePath, ` doctype html html(lang=_.locale) @@ -65,7 +68,8 @@ html(lang=_.locale) body p #{_.t('greetings')}! I’m #{_.t('fullName', { firstName: id.firstName, lastName: id.lastName })}, I’m #{age} years old, and I live in #{location.city}. p I work as a #{_.t('occupation.dev')}, but I’ve always #{_.toUpperCase('dreamt')} about being a #{_.t('occupation.fireman')}. -`) + `) + await fs.writeFile(join(srcDirPath, mainJSFileBasePath), mainJSFileContent) await fs.writeFile(join(srcDirPath, mainCSSFileBasePath), mainCSSFileContent)