Skip to content

Commit

Permalink
Add --match test
Browse files Browse the repository at this point in the history
  • Loading branch information
zerodevx committed Feb 11, 2022
1 parent bbedd94 commit 08d5b34
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 0 deletions.
Empty file added test/fixtures/media/cats.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added test/fixtures/media/dogs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added test/fixtures/media/index.html
Empty file.
Empty file added test/fixtures/media/unknown.xyz
Empty file.
6 changes: 6 additions & 0 deletions test/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ test('basic sitemaps', (t) => {
t.true(xml.includes('<loc>https://x.com/blog</loc>'))
t.true(xml.includes('<loc>https://x.com/blog/mixed-2</loc>'))
t.true(xml.includes('<loc>https://x.com/blog/events/event-1</loc>'))
t.true(xml.includes('<loc>https://x.com/media</loc>'))
t.is(xml.slice(-1), '\n')
t.not(xml.slice(-2), '\n\n')
t.false(xml.includes('.html'))
Expand Down Expand Up @@ -82,3 +83,8 @@ test('can disable robots check', (t) => {
t.true(stdout.includes('https://x.com/noindex/not-indexed</loc>'))
t.true(stdout.includes('https://x.com/noindex/not-indexed-2</loc>'))
})

test('match media assets', (t) => {
const { stdout } = run('fixtures', '-m', '**/*.{jpg,png}', '-o', '-f', 'txt')
t.is(stdout, 'https://x.com/media/cats.jpg\nhttps://x.com/media/dogs.png')
})

0 comments on commit 08d5b34

Please sign in to comment.