Skip to content

Commit

Permalink
test: refactor let into const
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowtime2000 committed Dec 5, 2020
1 parent ba45514 commit 94a19e1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion test/config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('Config Tests', () => {
})

it('config.filter works', () => {
let template = 'My favorite food is <%= it.fav %>'
const template = 'My favorite food is <%= it.fav %>'

expect(render(template, {})).toEqual('My favorite food is undefined')

Expand Down
2 changes: 1 addition & 1 deletion test/file-handlers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describe('Simple renderFile tests', () => {

describe('File location tests', () => {
it('locates a file with the views option', async () => {
let res = await renderFile(
const res = await renderFile(
'simple.eta',
{ name: 'Ada' },
{ views: path.join(__dirname, 'templates') }
Expand Down
10 changes: 5 additions & 5 deletions test/file-utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ describe('Filepath caching', () => {
// This test renders templates/has-include.eta with caching enabled, then checks to make sure
// `config.filepathCache` contains the expected result afterward

let viewsDir = path.join(__dirname, 'templates')
const viewsDir = path.join(__dirname, 'templates')

let templateResult = await renderFile('has-include', {}, { views: viewsDir, cache: true })
const templateResult = await renderFile('has-include', {}, { views: viewsDir, cache: true })

expect(templateResult).toEqual(
`This is the outermost template. Now we'll include a partial
Expand All @@ -36,11 +36,11 @@ Hi Test Runner`
// Filepath caching is based on the premise that given the same path, includer filename, root directory, and views directory (or directories)
// the getPath function will always return the same result (assuming that caching is enabled and we're not expecting the templates to change)

let pathToHasInclude = `{"filename":"${viewsDir}/has-include.eta","path":"./partial","views":"${viewsDir}"}`
const pathToHasInclude = `{"filename":"${viewsDir}/has-include.eta","path":"./partial","views":"${viewsDir}"}`

let pathToPartial = `{"filename":"${viewsDir}/partial.eta","path":"./simple","views":"${viewsDir}"}`
const pathToPartial = `{"filename":"${viewsDir}/partial.eta","path":"./simple","views":"${viewsDir}"}`

let pathToSimple = `{"path":"has-include","views":"${viewsDir}"}`
const pathToSimple = `{"path":"has-include","views":"${viewsDir}"}`

expect(config.filepathCache).toEqual({
[pathToHasInclude]: `${viewsDir}/partial.eta`,
Expand Down
20 changes: 10 additions & 10 deletions test/render.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Simple Render checks', () => {
})
it('Rendering function works', async () => {
const template = 'Hello <%= await it.getName() %>!'
let getName = () => {
const getName = () => {
return new Promise((res) => {
setTimeout(() => {
res('Ada')
Expand All @@ -32,7 +32,7 @@ describe('Simple Render checks', () => {
})
it('Rendering async function works', async () => {
const template = 'Hello <%= await it.getName() %>!'
let getName = () => {
const getName = () => {
return new Promise((res) => {
setTimeout(() => {
res('Ada')
Expand Down Expand Up @@ -67,15 +67,15 @@ describe('Renders with different scopes', () => {

describe('processTemplate plugin', () => {
it('Simple plugin works correctly', () => {
let template = ':thumbsup:'
const template = ':thumbsup:'

let emojiTransform = {
const emojiTransform = {
processTemplate: function (str: string) {
return str.replace(':thumbsup:', '👍')
}
}

let res = render(
const res = render(
template,
{},
{
Expand All @@ -87,27 +87,27 @@ describe('processTemplate plugin', () => {
})

it('Multiple chained plugins work correctly', () => {
let template = ':thumbsup: This is a cool template'
const template = ':thumbsup: This is a cool template'

let emojiTransform = {
const emojiTransform = {
processTemplate: function (str: string) {
return str.replace(':thumbsup:', '👍')
}
}

let capitalizeCool = {
const capitalizeCool = {
processTemplate: function (str: string) {
return str.replace('cool', 'COOL')
}
}

let replaceThumbsUp = {
const replaceThumbsUp = {
processTemplate: function (str: string) {
return str.replace('👍', '✨')
}
}

let res = render(
const res = render(
template,
{},
{
Expand Down

0 comments on commit 94a19e1

Please sign in to comment.