Skip to content

Commit

Permalink
Add async test
Browse files Browse the repository at this point in the history
  • Loading branch information
nebrelbug committed Feb 1, 2020
1 parent f568e3d commit fc1966d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/render.spec.ts
@@ -1,5 +1,6 @@
import Render from '../src/render'
import Compile from '../src/compile'
import { Config } from '../src/config'

describe('Simple Render checks', () => {
describe('Render works', () => {
Expand All @@ -14,5 +15,16 @@ describe('Simple Render checks', () => {
'Hi Ada Lovelace!'
)
})
it('Rendering function works', async () => {
let template = 'Hello {{ await it.getName() }}!'
let getName = () => {
return new Promise((res, rej) => {
setTimeout(() => {
res('Ada')
}, 1000)
})
}
expect(await Render(template, { getName: getName }, { async: true })).toEqual('Hello Ada!')
})
})
})

0 comments on commit fc1966d

Please sign in to comment.