Skip to content

Commit 8a3fb73

Browse files
authored
Remove yaml scheduled workflows test (#43391)
1 parent 0cf27c1 commit 8a3fb73

File tree

1 file changed

+0
-49
lines changed

1 file changed

+0
-49
lines changed

src/content-linter/tests/lint-files.js

-49
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,6 @@ describe('lint markdown content', () => {
345345
let content,
346346
ast,
347347
links,
348-
yamlScheduledWorkflows,
349348
isHidden,
350349
isEarlyAccess,
351350
isSitePolicy,
@@ -377,40 +376,6 @@ describe('lint markdown content', () => {
377376
visit(ast, ['link', 'definition'], (node) => {
378377
links.push(node.url)
379378
})
380-
381-
yamlScheduledWorkflows = []
382-
visit(ast, 'code', (node) => {
383-
if (
384-
/ya?ml/.test(node.lang) &&
385-
node.value.includes('schedule:') &&
386-
node.value.includes('cron:')
387-
) {
388-
yamlScheduledWorkflows.push(node.value)
389-
}
390-
})
391-
392-
const context = {
393-
currentLanguage: 'en',
394-
// Any Liquid that might use our `ifversion` plugin requires and
395-
// expects that there's a `currentVersionObj` object present in the
396-
// environment.
397-
currentVersionObj: {},
398-
}
399-
400-
// visit is not async-friendly so we need to do an async map to parse the YML snippets
401-
yamlScheduledWorkflows = (
402-
await Promise.all(
403-
yamlScheduledWorkflows.map(async (snippet) => {
404-
// If we don't parse the Liquid first, yaml loading chokes on {% raw %} tags
405-
const rendered = await liquid.parseAndRender(snippet, context)
406-
const parsed = yaml.load(rendered)
407-
if (!parsed?.on?.schedule?.cron) return []
408-
return parsed.on.schedule
409-
}),
410-
)
411-
)
412-
.flat()
413-
.map((schedule) => schedule.cron)
414379
})
415380

416381
test('placeholder string is not present in any markdown files', async () => {
@@ -481,20 +446,6 @@ describe('lint markdown content', () => {
481446
expect(matches.length, errorMessage).toBe(0)
482447
})
483448

484-
test('yaml snippets that include scheduled workflows must not run on the hour', async () => {
485-
const hourlySchedules = yamlScheduledWorkflows.filter((schedule) => {
486-
const hour = schedule.split(' ')[0]
487-
// return any minute cron segments that equal 0, 00, 000, etc.
488-
return !/[^0]/.test(hour)
489-
})
490-
expect(hourlySchedules).toEqual([])
491-
})
492-
493-
// Note this only ensures that scheduled workflow snippets are unique _per Markdown file_
494-
test('yaml snippets that include scheduled workflows run at unique times', () => {
495-
expect(yamlScheduledWorkflows.length).toEqual(new Set(yamlScheduledWorkflows).size)
496-
})
497-
498449
test('must not leak Early Access doc URLs', async () => {
499450
// Only execute for docs that are NOT Early Access
500451
if (!isEarlyAccess) {

0 commit comments

Comments
 (0)