Skip to content

Commit

Permalink
Filter out drafts from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
silvenon committed Aug 2, 2024
1 parent 8dbfc31 commit f1bbecd
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions posts/__tests__/posts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit f1bbecd

Please # to comment.