diff --git a/package.json b/package.json index b71b92ac1..22aab8f25 100644 --- a/package.json +++ b/package.json @@ -113,6 +113,7 @@ "@semantic-release/git", { "assets": [ + "package.json", "docs", "CHANGELOG.md" ], diff --git a/test/integration/liquid/fs-option.ts b/test/integration/liquid/fs-option.ts index 2ab424de3..be68f35ae 100644 --- a/test/integration/liquid/fs-option.ts +++ b/test/integration/liquid/fs-option.ts @@ -4,9 +4,12 @@ import { Liquid } from '../../../src/liquid' describe('LiquidOptions#fs', function () { let engine: Liquid const fs = { - exists: () => Promise.resolve(true), - readFile: () => Promise.resolve('test file content'), - resolve: () => 'resolved' + exists: (x: string) => Promise.resolve(x.match(/^\/root\/files\//)), + existsSync: (x: string) => x.match(/^\/root\/files\//), + readFile: (x: string) => Promise.resolve(`content for ${x}`), + readFileSync: (x: string) => `content for ${x}`, + fallback: (x: string) => '/root/files/fallback', + resolve: (base: string, path: string) => base + path } beforeEach(function () { engine = new Liquid({ @@ -14,8 +17,18 @@ describe('LiquidOptions#fs', function () { fs } as any) }) - it('should be used to read templates', function () { - return engine.renderFile('files/foo') - .then(x => expect(x).to.equal('test file content')) + it('should be used to read templates', async function () { + const html = await engine.renderFile('files/foo') + expect(html).to.equal('content for /root/files/foo') + }) + + it('should support fallback', async function () { + const html = await engine.renderFile('notexist/foo') + expect(html).to.equal('content for /root/files/fallback') + }) + + it('should support renderSync', function () { + const html = engine.renderFileSync('notexist/foo') + expect(html).to.equal('content for /root/files/fallback') }) })