Skip to content

Commit

Permalink
style: standard 14
Browse files Browse the repository at this point in the history
  • Loading branch information
lidel committed Sep 12, 2019
1 parent 4b6e787 commit b6627a1
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion add-on/src/lib/dir-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const mainStyle = require('ipfs-http-response/src/dir-view/style')
function buildFilesList (path, links) {
const rows = links.map((link) => {
let row = [
`<div class="ipfs-icon ipfs-_blank">&nbsp;</div>`,
'<div class="ipfs-icon ipfs-_blank">&nbsp;</div>',
`<a href="${path}${path.endsWith('/') ? '' : '/'}${link.name}">${link.name}</a>`,
filesize(link.size)
]
Expand Down
6 changes: 4 additions & 2 deletions add-on/src/popup/browser-action/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ module.exports = function header (props) {
${browser.i18n.getMessage('panel_headerIpfsNodeIconLabel')}
</h1>
<div class="tc ma0 pa0">
${powerIcon({ active,
${powerIcon({
active,
title: 'panel_headerActiveToggleTitle',
action: onToggleActive
})}
${optionsIcon({ active,
${optionsIcon({
active,
title: 'panel_openPreferences',
action: onOpenPrefs
})}
Expand Down
2 changes: 1 addition & 1 deletion add-on/src/popup/quick-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ async function processFiles (state, emitter, files) {
} catch (err) {
console.error('Unable to perform quick upload', err)
// keep upload tab and display error message in it
state.message = `Unable to upload to IPFS API:`
state.message = 'Unable to upload to IPFS API:'
state.progress = `${err}`
emitter.emit('render')
}
Expand Down
10 changes: 5 additions & 5 deletions test/functional/lib/ipfs-path.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ describe('ipfs-path.js', function () {
})
it('should resolve URL with /ipfs/ path to the custom gateway if provided', function () {
const url = 'https://example.com/ipfs/bafybeicgmdpvw4duutrmdxl4a7gc52sxyuk7nz5gby77afwdteh3jc5bqa/wiki/Mars.html?argTest#hashTest'
expect(ipfsPathValidator.resolveToPublicUrl(url, 'https://example.com/')).to.equal(`https://example.com/ipfs/bafybeicgmdpvw4duutrmdxl4a7gc52sxyuk7nz5gby77afwdteh3jc5bqa/wiki/Mars.html?argTest#hashTest`)
expect(ipfsPathValidator.resolveToPublicUrl(url, 'https://example.com/')).to.equal('https://example.com/ipfs/bafybeicgmdpvw4duutrmdxl4a7gc52sxyuk7nz5gby77afwdteh3jc5bqa/wiki/Mars.html?argTest#hashTest')
})
it('should resolve /ipfs/ path to itself attached to the default public gateway', function () {
const path = '/ipfs/bafybeicgmdpvw4duutrmdxl4a7gc52sxyuk7nz5gby77afwdteh3jc5bqa/wiki/Mars.html?argTest#hashTest'
Expand Down Expand Up @@ -391,13 +391,13 @@ describe('ipfs-path.js', function () {
it('should resolve URL with /ipns/ path', async function () {
const url = 'https://example.com/ipns/docs.ipfs.io/foo/bar?argTest#hashTest'
const expectedCid = 'QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR'
spoofIpfsResolve(ipfs, `/ipns/docs.ipfs.io/foo/bar`, `/ipfs/${expectedCid}`)
spoofIpfsResolve(ipfs, '/ipns/docs.ipfs.io/foo/bar', `/ipfs/${expectedCid}`)
expect(await ipfsPathValidator.resolveToCid(url)).to.equal(expectedCid)
})
it('should resolve /ipns/ path to the immutable /ipfs/ one', async function () {
const path = '/ipns/libp2p.io/foo/bar?argTest#hashTest'
const expectedCid = 'QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR'
spoofIpfsResolve(ipfs, `/ipns/libp2p.io/foo/bar`, `/ipfs/${expectedCid}`)
spoofIpfsResolve(ipfs, '/ipns/libp2p.io/foo/bar', `/ipfs/${expectedCid}`)
expect(await ipfsPathValidator.resolveToCid(path)).to.equal(expectedCid)
})
it('should resolve URL of a DNSLink website to null if the value if DNSLink is not in cache', async function () {
Expand All @@ -414,7 +414,7 @@ describe('ipfs-path.js', function () {
spoofCachedDnslink(hostname, dnslinkResolver, dnslinkValue)
// Note the DNSLink value is ignored, and /ipns/<fqdn> is passed to ipfs.resolv internally
// This ensures the latest pointer is returned, instead of stale value from DNSLink cache
spoofIpfsResolve(ipfs, `/ipns/docs.ipfs.io/guides/concepts/dnslink/`, `/ipfs/${expectedCid}`)
spoofIpfsResolve(ipfs, '/ipns/docs.ipfs.io/guides/concepts/dnslink/', `/ipfs/${expectedCid}`)
expect(await ipfsPathValidator.resolveToCid(url)).to.equal(expectedCid)
})
// TODO: remove when https://github.com/ipfs/js-ipfs/issues/1918 is addressed
Expand All @@ -429,7 +429,7 @@ describe('ipfs-path.js', function () {
// This ensures the latest pointer is returned, instead of stale value from DNSLink cache
// js-ipfs v0.34 does not support DNSLinks in ipfs.name.resolve: https://github.com/ipfs/js-ipfs/issues/1918
const resolve = stub(ipfs, 'resolve')
resolve.withArgs(`/ipns/docs.ipfs.io/guides/concepts/dnslink/`).throws(new Error('resolve non-IPFS names is not implemented'))
resolve.withArgs('/ipns/docs.ipfs.io/guides/concepts/dnslink/').throws(new Error('resolve non-IPFS names is not implemented'))
// until it is implemented, we have a workaround that falls back to value from dnslink
resolve.withArgs('/ipns/QmRV5iNhGoxBaAcbucMAW9WtVHbeehXhAdr5CZQDhL55Xk/guides/concepts/dnslink/').resolves(`/ipfs/${expectedCid}`)
resolve.throws((arg) => new Error(`Unexpected stubbed call ipfs.resolve(${arg})`))
Expand Down
2 changes: 1 addition & 1 deletion test/functional/lib/ipfs-proxy/enable-command.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ describe('lib/ipfs-proxy/enable-command', () => {

// confirm build permission request failed with error
expect(requestAccess.called).to.equal(false)
expect(() => { if (error) throw error }).to.throw(`User denied access to selected commands over IPFS proxy: id`)
expect(() => { if (error) throw error }).to.throw('User denied access to selected commands over IPFS proxy: id')

// ensure explicit version acl is still missing
const versionAcl = await accessControl.getAccess(getScope(), 'version')
Expand Down
4 changes: 2 additions & 2 deletions test/functional/lib/options.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('storeMissingOptions()', function () {

describe('hostTextToArray()', function () {
it('should sort, dedup hostnames, drop non-FQDNs and produce an array', () => {
const text = `zombo.com\n two.com \n totally not a FQDN \none.pl \nTWO.com\n\n`
const text = 'zombo.com\n two.com \n totally not a FQDN \none.pl \nTWO.com\n\n'
const array = ['one.pl', 'two.com', 'zombo.com']
expect(hostTextToArray(text)).to.be.an('array').to.have.ordered.members(array)
})
Expand All @@ -70,7 +70,7 @@ describe('hostTextToArray()', function () {
describe('hostArrayToText()', function () {
it('should sort, deduplicate, drop non-FQDNs and produce multiline string', () => {
const array = ['zombo.com ', 'two.com ', 'ONE.pl ', 'one.pl', 'totall not a FQDN', 'zombo.com']
const text = `one.pl\ntwo.com\nzombo.com`
const text = 'one.pl\ntwo.com\nzombo.com'
expect(hostArrayToText(array)).to.be.a('string').equal(text)
})
})
4 changes: 2 additions & 2 deletions test/functional/pages/proxy-access-dialog/page.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('pages/proxy-access-dialog/page', () => {
expect(() => { res = createProxyAccessDialogPage(i18n)(state).toString() }).to.not.throw()
expect(res).to.have.string(`page_proxyAccessDialog_title[${state.scope},${state.permissions}]`)
expect(res).to.have.string(`page_proxyAccessDialog_wildcardCheckbox_label[${state.scope}]`)
expect(res).to.have.string(`page_proxyAccessDialog_denyButton_text`)
expect(res).to.have.string(`page_proxyAccessDialog_allowButton_text`)
expect(res).to.have.string('page_proxyAccessDialog_denyButton_text')
expect(res).to.have.string('page_proxyAccessDialog_allowButton_text')
})
})

0 comments on commit b6627a1

Please sign in to comment.