Skip to content

Commit

Permalink
chore: update all deps
Browse files Browse the repository at this point in the history
  • Loading branch information
kentcdodds committed Nov 3, 2021
1 parent 1085dfe commit 08a9001
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@
"validate": "kcd-scripts validate"
},
"dependencies": {
"@babel/runtime": "^7.14.6",
"@types/hast": "^2.3.2",
"@types/mdast": "^3.0.7",
"@babel/runtime": "^7.16.0",
"@types/hast": "^2.3.4",
"@types/mdast": "^3.0.10",
"hast-util-from-parse5": "^6.0.1",
"parse5": "^6.0.1",
"unified": "^9.2.2",
"unist-util-visit": "^2.0.3"
},
"devDependencies": {
"@types/jest": "^26.0.24",
"kcd-scripts": "^11.1.0",
"@types/jest": "^27.0.2",
"kcd-scripts": "^11.2.2",
"remark": "^13.0.0",
"remark-html": "^13.0.1",
"typescript": "^4.3.5"
"remark-html": "^13.0.2",
"typescript": "^4.4.4"
},
"eslintConfig": {
"extends": "./node_modules/kcd-scripts/eslint.js"
Expand Down
26 changes: 13 additions & 13 deletions src/__tests__/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test('smoke test', async () => {
const transformer = getTransformer()
const result = await remark()
.use(remarkEmbedder, {transformers: [transformer]})
.use(remarkHTML)
.use(remarkHTML, {sanitize: false})
.process(
`
This is a great site:
Expand All @@ -50,7 +50,7 @@ test('works with same name as link links', async () => {
const transformer = getTransformer()
const result = await remark()
.use(remarkEmbedder, {transformers: [transformer]})
.use(remarkHTML)
.use(remarkHTML, {sanitize: false})
.process(`[https://some-site.com](https://some-site.com)`)

expect(result.toString()).toMatchInlineSnapshot(
Expand All @@ -64,15 +64,15 @@ test('requests are cached', async () => {
const getHTMLMock = transformer.getHTML as jest.Mock
await remark()
.use(remarkEmbedder, {cache: myCache, transformers: [transformer]})
.use(remarkHTML)
.use(remarkHTML, {sanitize: false})
.process('https://some-site.com')

expect(getHTMLMock).toHaveBeenCalledTimes(1)
getHTMLMock.mockClear()

await remark()
.use(remarkEmbedder, {cache: myCache, transformers: [transformer]})
.use(remarkHTML)
.use(remarkHTML, {sanitize: false})
.process('https://some-site.com')

expect(getHTMLMock).not.toHaveBeenCalled()
Expand All @@ -83,7 +83,7 @@ test(`does nothing with markdown that doesn't match`, async () => {
const transformer = getTransformer()
const result = await remark()
.use(remarkEmbedder, {cache: myCache, transformers: [transformer]})
.use(remarkHTML)
.use(remarkHTML, {sanitize: false})
.process(
`
# This is
Expand Down Expand Up @@ -132,7 +132,7 @@ test('error messages are handy', async () => {
},
],
})
.use(remarkHTML)
.use(remarkHTML, {sanitize: false})
.process(`https://some-site.com/error`)
.catch(e => e)

Expand All @@ -154,7 +154,7 @@ test('transformers can change their mind by returning null', async () => {
},
],
})
.use(remarkHTML)
.use(remarkHTML, {sanitize: false})
.process('https://some-site.com/no-change')

expect(result.toString()).toMatchInlineSnapshot(
Expand All @@ -181,7 +181,7 @@ test('transformers can be configured', async () => {
.use(remarkEmbedder, {
transformers: [[transformer, config as TConfig]],
})
.use(remarkHTML)
.use(remarkHTML, {sanitize: false})
.process('some-site.com/config')

expect(transformer.getHTML).toHaveBeenCalledWith(
Expand All @@ -201,7 +201,7 @@ test('shouldTransform can be async', async () => {
.use(remarkEmbedder, {
transformers: [transformer],
})
.use(remarkHTML).process(`
.use(remarkHTML, {sanitize: false}).process(`
https://some-site.com/transform-me
https://some-site.com/do-not-transform
Expand All @@ -218,7 +218,7 @@ test('handleHTML returns html', async () => {
const handleHTML = jest.fn(html => `<div>${html}</div>`)
const result = await remark()
.use(remarkEmbedder, {transformers: [transformer], handleHTML})
.use(remarkHTML)
.use(remarkHTML, {sanitize: false})
.process(`[https://some-site.com](https://some-site.com)`)

expect(result.toString()).toMatchInlineSnapshot(
Expand All @@ -239,7 +239,7 @@ test('handleHTML gets null', async () => {
],
handleHTML,
})
.use(remarkHTML)
.use(remarkHTML, {sanitize: false})
.process(`[https://some-site.com](https://some-site.com)`)

expect(result.toString()).toMatchInlineSnapshot(
Expand All @@ -255,7 +255,7 @@ test('can handle errors', async () => {
const handleError = jest.fn(({error}) => `<div>${error.message}</div>`)
const result = await remark()
.use(remarkEmbedder, {transformers: [transformer], handleError})
.use(remarkHTML)
.use(remarkHTML, {sanitize: false})
.process(`[https://some-site.com](https://some-site.com)`)

expect(result.toString()).toMatchInlineSnapshot(
Expand All @@ -280,7 +280,7 @@ test('handleError can return null', async () => {
const handleError = jest.fn(() => null)
const result = await remark()
.use(remarkEmbedder, {transformers: [transformer], handleError})
.use(remarkHTML)
.use(remarkHTML, {sanitize: false})
.process(`[https://some-site.com](https://some-site.com)`)

expect(result.toString()).toMatchInlineSnapshot(
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const remarkEmbedder: Plugin<[RemarkEmbedderOptions]> = ({
return
}

const value = isText ? (node as Text).value : (node as Link).url
const value = isText ? node.value : node.url
const urlString = getUrlString(value)
if (!urlString) {
return
Expand Down

0 comments on commit 08a9001

Please sign in to comment.