From b2bd5f27460dc143a604b09f5567d8a1fcf58b14 Mon Sep 17 00:00:00 2001 From: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Date: Mon, 7 Mar 2022 11:17:52 -0800 Subject: [PATCH] fix: linkify tests (#1064) * replace ipfs.git.sexy with wiki-on-ipfs * chore: typo fix --- CONTRIBUTING.md | 2 +- test/data/linkify-demo.html | 4 ++-- test/functional/lib/dnslink.test.js | 4 ++-- .../lib/ipfs-request-gateway-redirect.test.js | 12 ++++++------ 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 46dedf7e5..537c6fd3b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -28,7 +28,7 @@ See the [GitHub Flow Guide](https://guides.github.com/introduction/flow/) for de Go to Transifex and join [IPFS Companion Translation Project](https://www.transifex.com/ipfs/ipfs-companion/) :sparkles: -If you want to downoad translations from Transifex and run them locally, make sure to read [Localization Notes](LOCALIZATION-NOTES.md) first. +If you want to download translations from Transifex and run them locally, make sure to read [Localization Notes](LOCALIZATION-NOTES.md) first. ## Writing Code diff --git a/test/data/linkify-demo.html b/test/data/linkify-demo.html index 40f8d259c..13736e38a 100644 --- a/test/data/linkify-demo.html +++ b/test/data/linkify-demo.html @@ -14,11 +14,11 @@

Should be linkified


/ipfs/bafkreigh2akiscaildcqabsyg3dfr6chu3fgpregiymsck7e7aqa4s52zy
ipfs://QmTAsnXoWmLZQEpvyZscrReFzqxP3pvULfGVgpJuayrp1w (cidv0b58)
ipfs://bafkreigh2akiscaildcqabsyg3dfr6chu3fgpregiymsck7e7aqa4s52zy (cidv1b32) -
ipns://ipfs.git.sexy +
ipns://en.wikipedia-on-ipfs.org
dweb:/ipfs/QmTAsnXoWmLZQEpvyZscrReFzqxP3pvULfGVgpJuayrp1w

Should NOT be linkified


ipfs:/QmTAsnXoWmLZQEpvyZscrReFzqxP3pvULfGVgpJuayrp1w -
ipns:/ipfs.git.sexy +
ipns:/en.wikipedia-on-ipfs.org
dweb://ipfs/QmTAsnXoWmLZQEpvyZscrReFzqxP3pvULfGVgpJuayrp1w

diff --git a/test/functional/lib/dnslink.test.js b/test/functional/lib/dnslink.test.js index ee0caa882..4c7d915ff 100644 --- a/test/functional/lib/dnslink.test.js +++ b/test/functional/lib/dnslink.test.js @@ -44,10 +44,10 @@ describe('dnslinkResolver', function () { describe('convertToIpnsPath(url)', function () { it('should return IPNS path', function () { - const url = new URL('http://ipfs.git.sexy/sketches/ipld_intro.html?a=b#c=d') + const url = new URL('http://en.wikipedia-on-ipfs.org/sketches/ipld_intro.html?a=b#c=d') const dnslinkResolver = createDnslinkResolver(getExternalNodeState) expect(dnslinkResolver.convertToIpnsPath(url)) - .to.equal('/ipns/ipfs.git.sexy/sketches/ipld_intro.html?a=b#c=d') + .to.equal('/ipns/en.wikipedia-on-ipfs.org/sketches/ipld_intro.html?a=b#c=d') }) }) }) diff --git a/test/functional/lib/ipfs-request-gateway-redirect.test.js b/test/functional/lib/ipfs-request-gateway-redirect.test.js index d8b5fc273..59a05650d 100644 --- a/test/functional/lib/ipfs-request-gateway-redirect.test.js +++ b/test/functional/lib/ipfs-request-gateway-redirect.test.js @@ -209,13 +209,13 @@ describe('modifyRequest.onBeforeRequest:', function () { state.ipfsNodeType = 'external' }) it('should be served from custom gateway if {path} points to a FQDN with existing dnslink', function () { - const request = url2request('https://google.com/ipns/ipfs.git.sexy/index.html?argTest#hashTest') + const request = url2request('https://google.com/ipns/en.wikipedia-on-ipfs.org/index.html?argTest#hashTest') // stub the existence of valid dnslink - const fqdn = 'ipfs.git.sexy' + const fqdn = 'en.wikipedia-on-ipfs.org' dnslinkResolver.readDnslinkFromTxtRecord = sinon.stub().withArgs(fqdn).returns('/ipfs/Qmazvovg6Sic3m9igZMKoAPjkiVZsvbWWc8ZvgjjK1qMss') // pretend API is online and we can do dns lookups with it state.peerCount = 1 - expect(modifyRequest.onBeforeRequest(request).redirectUrl).to.equal('http://localhost:8080/ipns/ipfs.git.sexy/index.html?argTest#hashTest') + expect(modifyRequest.onBeforeRequest(request).redirectUrl).to.equal('http://localhost:8080/ipns/en.wikipedia-on-ipfs.org/index.html?argTest#hashTest') }) it('should be served from custom gateway if {path} starts with a valid PeerID', function () { const request = url2request('https://google.com/ipns/QmSWnBwMKZ28tcgMFdihD8XS7p6QzdRSGf71cCybaETSsU/index.html?argTest#hashTest') @@ -229,13 +229,13 @@ describe('modifyRequest.onBeforeRequest:', function () { state.ipfsNodeType = 'embedded' }) it('should be served from public gateway if {path} points to a FQDN with existing dnslink', function () { - const request = url2request('https://google.com/ipns/ipfs.git.sexy/index.html?argTest#hashTest') + const request = url2request('https://google.com/ipns/en.wikipedia-on-ipfs.org/index.html?argTest#hashTest') // stub the existence of valid dnslink - const fqdn = 'ipfs.git.sexy' + const fqdn = 'en.wikipedia-on-ipfs.org' dnslinkResolver.readDnslinkFromTxtRecord = sinon.stub().withArgs(fqdn).returns('/ipfs/Qmazvovg6Sic3m9igZMKoAPjkiVZsvbWWc8ZvgjjK1qMss') // pretend API is online and we can do dns lookups with it state.peerCount = 1 - expect(modifyRequest.onBeforeRequest(request).redirectUrl).to.equal('https://ipfs.io/ipns/ipfs.git.sexy/index.html?argTest#hashTest') + expect(modifyRequest.onBeforeRequest(request).redirectUrl).to.equal('https://ipfs.io/ipns/en.wikipedia-on-ipfs.org/index.html?argTest#hashTest') }) it('should be served from public gateway if {path} starts with a valid PeerID', function () { const request = url2request('https://google.com/ipns/QmSWnBwMKZ28tcgMFdihD8XS7p6QzdRSGf71cCybaETSsU/index.html?argTest#hashTest')