From 40d604d3c9c04c3d1531faa52a5bdfe8ebed4eb1 Mon Sep 17 00:00:00 2001 From: Jason Etcovitch Date: Tue, 26 Jan 2021 15:59:19 -0500 Subject: [PATCH] Add test to check content files against `liquid.parse` (#17479) * Add the test * Don't forget this require --- tests/content/lint-files.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/content/lint-files.js b/tests/content/lint-files.js index 68d29c4ed1..757e4b2c46 100644 --- a/tests/content/lint-files.js +++ b/tests/content/lint-files.js @@ -11,6 +11,7 @@ const frontmatter = require('../../lib/frontmatter') const languages = require('../../lib/languages') const { tags } = require('../../lib/liquid-tags/extended-markdown') const ghesReleaseNotesSchema = require('../../lib/release-notes-schema') +const renderContent = require('../../lib/render-content') const rootDir = path.join(__dirname, '../..') const contentDir = path.join(rootDir, 'content') @@ -296,6 +297,15 @@ describe('lint-files', () => { } }) }) + + test('contains valid Liquid', async () => { + // If Liquid can't parse the file, it'll throw an error. + // For example, the following is invalid and will fail this test: + // {% if currentVersion ! "github-ae@latest" %} + await expect(renderContent.liquid.parse(content)) + .resolves + .toBeTruthy() + }) } )