Improve link meta fetching for bsky links (#54)

* Add share dropdown item to profiles

* Temporary improvement for links to content on the network

* Enlarge text slightly on embed cards
This commit is contained in:
Paul Frazee 2023-01-19 12:30:28 -06:00 committed by GitHub
parent 0536a6afcf
commit 9230d52ff5
8 changed files with 123 additions and 23 deletions

View file

@ -1,4 +1,5 @@
import {LikelyType, getLinkMeta, getLikelyType} from '../../src/lib/link-meta'
import {mockedRootStore} from '../../__mocks__/state-mock'
const exampleComHtml = `<!doctype html>
<html>
@ -59,6 +60,7 @@ describe('getLinkMeta', () => {
'https://example.com/audio.ogg',
'https://example.com/text.txt',
'https://example.com/javascript.js',
'https://bsky.app/',
'https://bsky.app/index.html',
]
const outputs = [
@ -104,6 +106,12 @@ describe('getLinkMeta', () => {
likelyType: LikelyType.Other,
url: 'https://example.com/javascript.js',
},
{
likelyType: LikelyType.AtpData,
url: '/',
title: 'Bluesky',
description: 'A new kind of social network',
},
{
likelyType: LikelyType.AtpData,
url: '/index.html',
@ -127,7 +135,7 @@ describe('getLinkMeta', () => {
})
})
const input = inputs[i]
const output = await getLinkMeta(input)
const output = await getLinkMeta(mockedRootStore, input)
expect(output).toEqual(outputs[i])
}
})

View file

@ -43,7 +43,7 @@ describe('LinkMetasViewModel', () => {
const result = await viewModel.getLinkMeta(mockedMeta.url)
expect(getLinkMetaMockSpy).toHaveBeenCalledWith(mockedMeta.url)
expect(getLinkMetaMockSpy).toHaveBeenCalledWith(rootStore, mockedMeta.url)
expect(result).toEqual(mockedMeta)
})