-
-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #712 from microlinkhq/test
test: add snapshots
- Loading branch information
Showing
11 changed files
with
4,154 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+52 Bytes
(110%)
packages/metascraper/test/integration/bfi/snapshots/index.js.snap
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')) | ||
}) |
Large diffs are not rendered by default.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
packages/metascraper/test/integration/hola/snapshots/index.js.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
3,703
packages/metascraper/test/integration/sfstandard/input.html
Large diffs are not rendered by default.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
packages/metascraper/test/integration/sfstandard/snapshots/index.js.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 added
BIN
+641 Bytes
packages/metascraper/test/integration/sfstandard/snapshots/index.js.snap
Binary file not shown.