From f1bbecd025d0d7cf112999728335461046af0fde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matija=20Marohni=C4=87?= Date: Fri, 2 Aug 2024 23:43:18 +0200 Subject: [PATCH] Filter out drafts from tests --- posts/__tests__/posts.test.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/posts/__tests__/posts.test.ts b/posts/__tests__/posts.test.ts index 7086d1ed..462814cd 100644 --- a/posts/__tests__/posts.test.ts +++ b/posts/__tests__/posts.test.ts @@ -23,10 +23,18 @@ const postModules = { describe('validate posts', () => { test.each( - Object.keys(postModules).map((importPath) => [ - path.relative('/posts', importPath), - importPath, - ]), + Object.keys(postModules) + .filter((importPath) => { + const meta = postModules[importPath] + if ('seriesPart' in meta) { + return ( + 'published' in + postModules[path.join(path.dirname(importPath), 'series.json')] + ) + } + return 'published' in meta + }) + .map((importPath) => [path.relative('/posts', importPath), importPath]), )('%s', async (basename, importPath) => { const meta = postModules[importPath] expect(meta).toHaveProperty('title')