Skip to content

Commit

Permalink
fix: linkify tests (#1064)
Browse files Browse the repository at this point in the history
* replace ipfs.git.sexy with wiki-on-ipfs
* chore: typo fix
  • Loading branch information
SgtPooki authored Mar 7, 2022
1 parent 9ebfbba commit b2bd5f2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions test/data/linkify-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ <h1> Should be linkified</h1>
<br>/ipfs/bafkreigh2akiscaildcqabsyg3dfr6chu3fgpregiymsck7e7aqa4s52zy
<br>ipfs://QmTAsnXoWmLZQEpvyZscrReFzqxP3pvULfGVgpJuayrp1w (cidv0b58)
<br>ipfs://bafkreigh2akiscaildcqabsyg3dfr6chu3fgpregiymsck7e7aqa4s52zy (cidv1b32)
<br>ipns://ipfs.git.sexy
<br>ipns://en.wikipedia-on-ipfs.org
<br>dweb:/ipfs/QmTAsnXoWmLZQEpvyZscrReFzqxP3pvULfGVgpJuayrp1w
<h1> Should NOT be linkified</h1>
<br>ipfs:/QmTAsnXoWmLZQEpvyZscrReFzqxP3pvULfGVgpJuayrp1w
<br>ipns:/ipfs.git.sexy
<br>ipns:/en.wikipedia-on-ipfs.org
<br>dweb://ipfs/QmTAsnXoWmLZQEpvyZscrReFzqxP3pvULfGVgpJuayrp1w
<br>
</p>
Expand Down
4 changes: 2 additions & 2 deletions test/functional/lib/dnslink.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
})
})
Expand Down
12 changes: 6 additions & 6 deletions test/functional/lib/ipfs-request-gateway-redirect.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')
Expand Down

0 comments on commit b2bd5f2

Please sign in to comment.