Skip to content

Commit

Permalink
Merge pull request #712 from microlinkhq/test
Browse files Browse the repository at this point in the history
test: add snapshots
  • Loading branch information
Kikobeats authored Jun 25, 2024
2 parents 5231593 + b421313 commit 5026309
Show file tree
Hide file tree
Showing 11 changed files with 4,154 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Generated by [AVA](https://avajs.dev).
> Snapshot 1
{
audio: null,
audio: 'https://podcast-stream.wbez.org/recast/the-pie/20210113155621-ThePie-E04.mp3',
author: null,
date: '2021-02-12T16:09:42.000Z',
description: 'The expanding market influence of tech companies has sparked new fear of an old economic problem – monopoly power. In this episode, Eric Posner and Chad Syverson discuss whether these […]',
Expand Down
Binary file modified packages/metascraper/test/integration/bfi/snapshots/index.js.snap
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/metascraper/test/integration/bloomberg/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict'

const { readFile } = require('fs/promises')
const test = require('ava')
const { resolve } = require('path')
const test = require('ava')

const metascraper = require('../../..')([
require('metascraper-author')(),
Expand Down
32 changes: 32 additions & 0 deletions packages/metascraper/test/integration/hola/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'use strict'

const { readFile } = require('fs/promises')
const { resolve } = require('path')
const test = require('ava')

const metascraper = require('../../..')([
require('metascraper-author')(),
require('metascraper-date')(),
require('metascraper-description')(),
require('metascraper-audio')(),
require('metascraper-video')(),
require('metascraper-image')(),
require('metascraper-lang')(),
require('metascraper-logo')(),
require('metascraper-logo-favicon')(),
require('metascraper-manifest')(),
require('metascraper-publisher')(),
require('metascraper-title')(),
require('metascraper-url')(),
require('metascraper-readability')()
])

const url =
'https://www.hola.com/us/celebrities/20240624701307/rauw-alejandro-bruna-marquezine-dreams-to-accomplish/'

test('hola', async t => {
const html = await readFile(resolve(__dirname, 'input.html'))
const { logo, ...metadata } = await metascraper({ html, url })
t.snapshot(metadata)
t.true(logo.includes('apple-touch-icon'))
})
341 changes: 341 additions & 0 deletions packages/metascraper/test/integration/hola/input.html

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions packages/metascraper/test/integration/hola/snapshots/index.js.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Snapshot report for `test/integration/hola/index.js`

The actual snapshot is saved in `index.js.snap`.

Generated by [AVA](https://avajs.dev).

## hola

> Snapshot 1
{
audio: null,
author: 'Daniel Neira',
date: '2024-06-24T20:23:34.721Z',
description: '“She is gorgeous. Her vibe and personality are amazing. We had a great time working together,” Rauw said about Bruna.',
image: 'https://www.hola.com/us/horizon/landscape/2ec6ca11d80b-new-york-new-york-rauw-alejandro-and-bruna-marquezine-are-seen-during-a-photosho.jpg?im=Resize=(1200)',
lang: 'en',
publisher: 'Hola! US',
title: 'Rauw Alejandro and Bruna Marquezine on the dreams they want to accomplish: ‘To have kids and a serene love’',
url: 'https://www.hola.com/us/celebrities/20240624701307/rauw-alejandro-bruna-marquezine-dreams-to-accomplish/',
video: null,
}
Binary file not shown.
31 changes: 31 additions & 0 deletions packages/metascraper/test/integration/sfstandard/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
'use strict'

const { readFile } = require('fs/promises')
const { resolve } = require('path')
const test = require('ava')

const metascraper = require('../../..')([
require('metascraper-author')(),
require('metascraper-date')(),
require('metascraper-description')(),
require('metascraper-audio')(),
require('metascraper-video')(),
require('metascraper-image')(),
require('metascraper-lang')(),
require('metascraper-logo')(),
require('metascraper-logo-favicon')(),
require('metascraper-manifest')(),
require('metascraper-publisher')(),
require('metascraper-title')(),
require('metascraper-url')(),
require('metascraper-readability')()
])

const url =
'https://sfstandard.com/2024/06/24/service-fee-restaurants-san-francisco/'

;(process.env.CI ? test.skip : test)('sfstandard', async t => {
const html = await readFile(resolve(__dirname, 'input.html'))
const metadata = await metascraper({ html, url })
t.snapshot(metadata)
})
3,703 changes: 3,703 additions & 0 deletions packages/metascraper/test/integration/sfstandard/input.html

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Snapshot report for `test/integration/sfstandard/index.js`

The actual snapshot is saved in `index.js.snap`.

Generated by [AVA](https://avajs.dev).

## sfstandard

> Snapshot 1
{
audio: null,
author: 'lsariasfstandard.com',
date: '2024-06-24T18:59:54.000Z',
description: 'Diners hate them. Owners say they need them. But in the raging battle over restaurant service fees, it’s servers and cooks who are on the front lines.',
image: 'https://content.sfstandard.com/wp-content/uploads/2024/06/featured_20240621-junkfeeban.jpg?resize=1200%2C630',
lang: 'en',
logo: 'https://content.sfstandard.com/wp-content/uploads/2024/02/coloryellow-cropdefault-transparentfalse2x.png',
publisher: 'The San Francisco Standard',
title: 'Restaurant workers fear they could pay highest cost in junk-fee battle',
url: 'https://sfstandard.com/2024/06/24/service-fee-restaurants-san-francisco/',
video: null,
}
Binary file not shown.

0 comments on commit 5026309

Please sign in to comment.