Skip to content

Commit

Permalink
style: Revamp multi-line strings
Browse files Browse the repository at this point in the history
  • Loading branch information
fabschurt committed May 6, 2024
1 parent 86417e2 commit 939edb9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tests/adapter/pug.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ doctype html
html
body
p Hello, #{name} #{surname}.
`)
`)

const result = await (
renderTemplate(renderPug, readFile)(templateBasePath, {
Expand Down
3 changes: 2 additions & 1 deletion tests/domain/helpers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 4 additions & 2 deletions tests/domain/i18n.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -31,7 +32,8 @@ describe('#src/domain/i18n', () => {
]
}
}
`)
`)

await fs.writeFile(file2Path, `
{
"greetings": "Hello",
Expand All @@ -45,7 +47,7 @@ describe('#src/domain/i18n', () => {
]
}
}
`)
`)

const _parseProjectTranslations = (
parseProjectTranslations(
Expand Down
12 changes: 8 additions & 4 deletions tests/main.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ describe('#src/main', () => {
"city": "%SECRET_CITY%"
}
}
`)
`)

await fs.writeFile(transFilePath, `
{
"greetings": "Hello",
Expand All @@ -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)
Expand All @@ -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)

Expand Down

0 comments on commit 939edb9

Please sign in to comment.