Skip to content

Commit 0bc047c

Browse files
authored
Merge pull request #1904 from oasisprotocol/lw/partial-external-test
Test partial external URLs by filling them in
2 parents 70ecaec + 2c09e09 commit 0bc047c

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

.changelog/1904.trivial.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Test partial external URLs by filling them in

src/app/utils/__tests__/externalLinks.test.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,24 @@ onlyRunOnCI('externalLinks', () => {
2727
describe('should be reachable', () => {
2828
const { reddit, twitter } = externalLinksModule.socialMedia
2929
for (const [linksGroupName, linksGroup] of Object.entries(externalLinksModule)) {
30-
for (const [linkName, url] of Object.entries(linksGroup)) {
30+
for (const [linkName, originalUrl] of Object.entries(linksGroup)) {
31+
let url = originalUrl
3132
if (!url || typeof url !== 'string') continue
3233
if (!!reddit && url.startsWith(reddit)) continue // Reddit often returns 504
3334
if (!!twitter && url.startsWith(twitter)) continue // redirect loop
3435
if (url.startsWith(externalLinksModule.referrals.coinGecko)) continue // CoinGecko has CloudFlare DDOS protection
35-
if (url.startsWith(externalLinksModule.github.commit)) continue // We store only partial url in constants
36-
if (url.startsWith(externalLinksModule.github.releaseTag)) continue // We store only partial url in constants
37-
if (url.startsWith(externalLinksModule.ipfs.proxyPrefix)) continue // We store only partial url in constants
3836
if (url.startsWith('mailto')) continue // We can't test email addresses
3937

38+
if (url.startsWith(externalLinksModule.github.commit)) {
39+
url += '904840745dde1a5dfff6608213e50dfa4d4ee7c8'
40+
}
41+
if (url.startsWith(externalLinksModule.github.releaseTag)) {
42+
url += 'v1.2.0'
43+
}
44+
if (url.startsWith(externalLinksModule.ipfs.proxyPrefix)) {
45+
url += 'bafybeifx7yeb55armcsxwwitkymga5xf53dxiarykms3ygqic223w5sk3m'
46+
}
47+
4048
it.concurrent(`${linksGroupName} ${linkName} ${url}`, async () => {
4149
const response = await nodeFetch(url, { method: 'GET' })
4250
expect(response.status).toBe(200)

0 commit comments

Comments
 (0)