@@ -6,6 +6,8 @@ import { beforeAll, describe, expect, test } from 'vitest'
6
6
import yaml from 'js-yaml'
7
7
8
8
import { liquid } from '@/content-render/index.js'
9
+ import { getDataByLanguage } from '@/data-directory/lib/get-data.js'
10
+ import { allVersions } from '@/versions/lib/all-versions.js'
9
11
10
12
interface ReleaseNoteContent {
11
13
intro : string
@@ -34,7 +36,7 @@ describe('lint enterprise release notes', () => {
34
36
yamlContent = yaml . load ( fileContents ) as ReleaseNoteContent
35
37
} )
36
38
37
- test ( 'contains valid liquid' , ( ) => {
39
+ test ( 'contains valid liquid' , async ( ) => {
38
40
const { intro, sections } = yamlContent
39
41
let toLint : Record < string , string > = { intro }
40
42
for ( const key in sections ) {
@@ -54,9 +56,28 @@ describe('lint enterprise release notes', () => {
54
56
} )
55
57
}
56
58
59
+ // Create context with site data for rendering liquid variables
60
+ const context = {
61
+ currentLanguage : 'en' ,
62
+ currentVersionObj : allVersions [ 'free-pro-team@latest' ] ,
63
+ site : {
64
+ data : {
65
+ reusables : getDataByLanguage ( 'reusables' , 'en' ) ,
66
+ variables : getDataByLanguage ( 'variables' , 'en' ) ,
67
+ ui : getDataByLanguage ( 'ui' , 'en' ) ,
68
+ } ,
69
+ } ,
70
+ }
71
+
57
72
for ( const key in toLint ) {
58
73
if ( ! toLint [ key ] ) continue
74
+ // First check if liquid parses correctly
59
75
expect ( ( ) => liquid . parse ( toLint [ key ] ) , `${ key } contains invalid liquid` ) . not . toThrow ( )
76
+ // Then check if liquid renders correctly with context
77
+ await expect (
78
+ liquid . parseAndRender ( toLint [ key ] , context ) ,
79
+ `${ key } contains liquid that fails to render` ,
80
+ ) . resolves . not . toThrow ( )
60
81
}
61
82
} )
62
83
0 commit comments