mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-17 05:10:40 -07:00
25 lines
811 B
TypeScript
25 lines
811 B
TypeScript
import { resolve } from '../../src/parser/template'
|
|
import * as path from 'path'
|
|
import { expect, use } from 'chai'
|
|
import * as chaiAsPromised from 'chai-as-promised'
|
|
import { mock, restore } from '../stub/mockfs'
|
|
|
|
use(chaiAsPromised)
|
|
|
|
describe('template', function () {
|
|
before(() => mock({ '/foo/bar.html': 'bar' }))
|
|
after(restore)
|
|
|
|
describe('#resolve()', function () {
|
|
it('should resolve based on root', async function () {
|
|
const filepath = await resolve('bar.html', '/foo', { root: [] })
|
|
const expected = path.resolve('/foo/bar.html')
|
|
return expect(filepath).to.equal(expected)
|
|
})
|
|
it('should resolve based on root', function () {
|
|
return expect(resolve('foo.html', '/foo', { root: [] }))
|
|
.to.rejectedWith(/Failed to lookup foo.html in: \/foo/)
|
|
})
|
|
})
|
|
})
|