formatting for new prettier rules

This commit is contained in:
Matthias Kretschmann 2020-05-19 10:36:18 +02:00
parent d916f0df1e
commit d058fc815d
Signed by: m
GPG Key ID: 606EEEF3C479A91F
30 changed files with 61 additions and 91 deletions

View File

@ -62,7 +62,7 @@ export default class Account extends PureComponent<
{isBurner ? (
<button
className={styles.toggle}
onClick={event => this.toggleAccountInfo(event)}
onClick={(event) => this.toggleAccountInfo(event)}
title="Show More Account Info"
>
<Caret

View File

@ -19,9 +19,9 @@ const Indicator = ({
ref={forwardedRef}
>
<User.Consumer>
{user => (
{(user) => (
<Market.Consumer>
{market =>
{(market) =>
!user.isLogged || !market.networkMatch ? (
<span
className={styles.statusIndicatorCloseEnough}

View File

@ -40,7 +40,7 @@ export default class Popover extends PureComponent<{
)}
<Market.Consumer>
{market => (
{(market) => (
<div className={styles.popoverInfoline}>
{network && !market.networkMatch
? `Please connect to Custom RPC

View File

@ -20,7 +20,7 @@ export default class AccountStatus extends PureComponent<
}
private togglePopover() {
this.setState(prevState => ({
this.setState((prevState) => ({
isPopoverOpen: !prevState.isPopoverOpen
}))
}

View File

@ -17,7 +17,7 @@ function mockData(files: any) {
}
function flushPromises(ui: any, container: any) {
return new Promise(resolve =>
return new Promise((resolve) =>
setImmediate(() => {
render(ui, { container })
resolve(container)

View File

@ -12,7 +12,7 @@ export default function Dropzone({
disabled?: boolean
multiple?: boolean
}) {
const onDrop = useCallback(acceptedFiles => handleOnDrop(acceptedFiles), [
const onDrop = useCallback((acceptedFiles) => handleOnDrop(acceptedFiles), [
handleOnDrop
])

View File

@ -54,7 +54,7 @@ export default class Pagination extends PureComponent<
// adapt based on media query match
marginPagesDisplayed={smallViewport ? 0 : 1}
pageRangeDisplayed={smallViewport ? 3 : 6}
onPageChange={data => handlePageClick(data)}
onPageChange={(data) => handlePageClick(data)}
disableInitialCallback
previousLabel="←"
nextLabel="→"

View File

@ -52,7 +52,7 @@ export const VersionTableContracts = ({
Object.keys(contracts)
// sort alphabetically
.sort((a, b) => a.localeCompare(b))
.map(key => {
.map((key) => {
const submarineLink = `https://submarine.${
network === 'pacific'
? 'oceanprotocol'

View File

@ -148,7 +148,7 @@ export default class VersionNumbers extends PureComponent<
return (
<Market.Consumer>
{market => (
{(market) => (
<p className={styles.versionsMinimal}>
<a
title={`${squid.name} v${squid.version}\n${brizo.name} v${brizo.version}\n${aquarius.name} v${aquarius.version}`}

View File

@ -79,7 +79,7 @@ export default class AssetsUser extends PureComponent<
<>
{results
.slice(0, recent || undefined)
.filter(asset => !!asset)
.filter((asset) => !!asset)
.map((asset: any) => (
<AssetTeaser
list={list}

View File

@ -25,7 +25,7 @@ export default class ChannelTeaser extends Component<
// Get channel content
public channel = channels.items
.filter(({ tag }) => tag === this.props.channel)
.map(channel => channel)[0]
.map((channel) => channel)[0]
public state = {
channelAssets: [],

View File

@ -41,7 +41,7 @@ export default function Footer() {
</small>
<nav className={styles.links}>
{meta.social.map(site => (
{meta.social.map((site) => (
<a key={site.title} href={site.url}>
{site.title}
</a>

View File

@ -29,7 +29,7 @@ export default class Header extends PureComponent {
</NavLink>
<nav className={styles.headerMenu}>
{menu.map(item => (
{menu.map((item) => (
<MenuItem key={item.title} item={item} />
))}
<AccountStatus className={styles.accountStatus} />

View File

@ -22,7 +22,7 @@ export default class Web3message extends PureComponent<{ extended?: boolean }> {
return (
<User.Consumer>
{user => (
{(user) => (
<em
dangerouslySetInnerHTML={{
__html:

View File

@ -109,8 +109,8 @@ export default function AssetDetails({ metadata, ddo }: AssetDetailsProps) {
</h2>
<ul>
{metaFixed
.filter(item => item.show)
.map(item => (
.filter((item) => item.show)
.map((item) => (
<MetaFixedItem
key={shortid.generate()}
name={item.name}

View File

@ -134,7 +134,7 @@ export default class AssetFile extends PureComponent<
<Spinner message={messages[step]} />
) : (
<Market.Consumer>
{market => (
{(market) => (
<Button
primary
className={styles.buttonMain}

View File

@ -15,7 +15,7 @@ export default class AssetFilesDetails extends PureComponent<{
return files.length ? (
<>
<div className={styles.files}>
{files.map(file => (
{files.map((file) => (
<AssetFile key={file.index} ddo={ddo} file={file} />
))}
</div>

View File

@ -27,7 +27,7 @@ export default class Channel extends PureComponent<ChannelProps, ChannelState> {
// get content data based on received channel param
public channel = channels.items
.filter(({ tag }) => tag === this.props.match.params.channel)
.map(channel => channel)[0]
.map((channel) => channel)[0]
public state = {
results: [],

View File

@ -10,7 +10,7 @@ describe('MarketProvider', () => {
<User.Provider value={userMockConnected}>
<MarketProvider ocean={userMockConnected.ocean as any}>
<Market.Consumer>
{market => (
{(market) => (
<div data-testid="hello">{market.network}</div>
)}
</Market.Consumer>

View File

@ -10,7 +10,7 @@ class Channels extends Component {
return (
<Route title={channels.title} description={channels.description}>
<Content wide>
{channels.items.map(channel => (
{channels.items.map((channel) => (
<ChannelTeaser
key={channel.title}
channel={channel.tag}

View File

@ -113,7 +113,7 @@ export default class Files extends PureComponent<FilesProps, FilesStates> {
private addFile = async (url: string) => {
// check for duplicate urls
const duplicateFiles = this.props.files.filter(props =>
const duplicateFiles = this.props.files.filter((props) =>
url.includes(props.url)
)
@ -185,7 +185,7 @@ export default class Files extends PureComponent<FilesProps, FilesStates> {
</ul>
)}
{buttons.map(button => {
{buttons.map((button) => {
const isActive =
(button.id === 'url' && isFormShown) ||
(button.id === 'ipfs' && isIpfsFormShown)

View File

@ -155,7 +155,7 @@ export default class Step extends PureComponent<StepProps, {}> {
{lastStep && (
<Market.Consumer>
{market => (
{(market) => (
<Button
disabled={
!this.context.isLogged ||

View File

@ -143,7 +143,7 @@ class Publish extends Component<{}, PublishState> {
// Setting state for all fields
if (hasContent) {
this.setState(
prevState => ({
(prevState) => ({
validationStatus: {
...prevState.validationStatus,
[this.state.currentStep]: {
@ -158,7 +158,7 @@ class Publish extends Component<{}, PublishState> {
)
} else {
this.setState(
prevState => ({
(prevState) => ({
validationStatus: {
...prevState.validationStatus,
[this.state.currentStep]: {
@ -180,7 +180,7 @@ class Publish extends Component<{}, PublishState> {
// Step 1
//
if (validationStatus[1].name && validationStatus[1].files) {
this.setState(prevState => ({
this.setState((prevState) => ({
validationStatus: {
...prevState.validationStatus,
1: {
@ -190,7 +190,7 @@ class Publish extends Component<{}, PublishState> {
}
}))
} else {
this.setState(prevState => ({
this.setState((prevState) => ({
validationStatus: {
...prevState.validationStatus,
1: {
@ -205,7 +205,7 @@ class Publish extends Component<{}, PublishState> {
// Step 2
//
if (validationStatus[2].description && validationStatus[2].categories) {
this.setState(prevState => ({
this.setState((prevState) => ({
validationStatus: {
...prevState.validationStatus,
2: {
@ -215,7 +215,7 @@ class Publish extends Component<{}, PublishState> {
}
}))
} else {
this.setState(prevState => ({
this.setState((prevState) => ({
validationStatus: {
...prevState.validationStatus,
2: {
@ -234,7 +234,7 @@ class Publish extends Component<{}, PublishState> {
validationStatus[3].copyrightHolder &&
validationStatus[3].license
) {
this.setState(prevState => ({
this.setState((prevState) => ({
validationStatus: {
...prevState.validationStatus,
3: {
@ -244,7 +244,7 @@ class Publish extends Component<{}, PublishState> {
}
}))
} else {
this.setState(prevState => ({
this.setState((prevState) => ({
validationStatus: {
...prevState.validationStatus,
3: {
@ -337,7 +337,7 @@ class Publish extends Component<{}, PublishState> {
public render() {
return (
<Market.Consumer>
{market => (
{(market) => (
<Route
title="Publish"
description={`Publish a new data set into the Ocean Protocol ${market.network} Network.`}

View File

@ -67,7 +67,7 @@ export function register(config?: Config) {
function registerValidSW(swUrl: string, config?: Config) {
navigator.serviceWorker
.register(swUrl)
.then(registration => {
.then((registration) => {
registration.onupdatefound = () => {
const installingWorker = registration.installing
if (installingWorker == null) {
@ -103,7 +103,7 @@ function registerValidSW(swUrl: string, config?: Config) {
}
}
})
.catch(error => {
.catch((error) => {
console.error('Error during service worker registration:', error)
})
}
@ -111,7 +111,7 @@ function registerValidSW(swUrl: string, config?: Config) {
function checkValidServiceWorker(swUrl: string, config?: Config) {
// Check if the service worker can be found. If it can't reload the page.
fetch(swUrl)
.then(response => {
.then((response) => {
// Ensure service worker exists, and that we really are getting a JS file.
const contentType = response.headers.get('content-type')
if (
@ -120,7 +120,7 @@ function checkValidServiceWorker(swUrl: string, config?: Config) {
contentType.indexOf('javascript') === -1)
) {
// No service worker found. Probably a different app. Reload the page.
navigator.serviceWorker.ready.then(registration => {
navigator.serviceWorker.ready.then((registration) => {
registration.unregister().then(() => {
window.location.reload()
})
@ -139,7 +139,7 @@ function checkValidServiceWorker(swUrl: string, config?: Config) {
export function unregister() {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready.then(registration => {
navigator.serviceWorker.ready.then((registration) => {
registration.unregister()
})
}

View File

@ -13,17 +13,13 @@ describe('Publish', () => {
// Fill title
cy.get('input#name').type('Commons Integration Test')
// Open Add a file form
cy.get('button')
.contains('+ From URL')
.click()
cy.get('button').contains('+ From URL').click()
// Fill url of file
cy.get('input#url').type(
'https://oceanprotocol.com/tech-whitepaper.pdf'
)
// Add file to main form
cy.get('button')
.contains('Add File')
.click()
cy.get('button').contains('Add File').click()
// Verify and nove to next step
cy.get('button', { timeout: 60000 })
.contains('Next →')
@ -36,10 +32,7 @@ describe('Publish', () => {
// Pick category
cy.get('select#categories').select('Biology')
// Verify and move to next step
cy.get('button')
.contains('Next →')
.should('not.be.disabled')
.click()
cy.get('button').contains('Next →').should('not.be.disabled').click()
// Verify we are on next step
cy.get('article>div').should('contain', 'Authorship')
// Fill author
@ -49,10 +42,7 @@ describe('Publish', () => {
// Pick author
cy.get('select#license').select('Public Domain')
// Verify and move to next step
cy.get('button')
.contains('Next →')
.should('not.be.disabled')
.click()
cy.get('button').contains('Next →').should('not.be.disabled').click()
// Verify we are on next step
cy.get('article>div').should('contain', 'Register')
// Start publish process
@ -69,7 +59,7 @@ describe('Publish', () => {
cy.get('a')
.contains('See published asset')
.invoke('attr', 'href')
.then(href => {
.then((href) => {
cy.writeFile(
'cypress/fixtures/did.txt',
href.replace('/asset/', '')
@ -81,17 +71,13 @@ describe('Publish', () => {
// Fill title
cy.get('input#name').type('Commons Integration IPFS Test')
// Open Add a file form
cy.get('button')
.contains('+ From URL')
.click()
cy.get('button').contains('+ From URL').click()
// Fill url of file
cy.get('input#url').type(
'ipfs://QmX5LRpEVocfks9FNDnRoK2imf2fy9mPpP4wfgaDVXWfYD/video.mp4'
)
// Add file to main form
cy.get('button')
.contains('Add File')
.click()
cy.get('button').contains('Add File').click()
// Verify and nove to next step
cy.get('button', { timeout: 60000 })
.contains('Next →')
@ -104,10 +90,7 @@ describe('Publish', () => {
// Pick category
cy.get('select#categories').select('Biology')
// Verify and move to next step
cy.get('button')
.contains('Next →')
.should('not.be.disabled')
.click()
cy.get('button').contains('Next →').should('not.be.disabled').click()
// Verify we are on next step
cy.get('article>div').should('contain', 'Authorship')
// Fill author
@ -117,10 +100,7 @@ describe('Publish', () => {
// Pick author
cy.get('select#license').select('Public Domain')
// Verify and move to next step
cy.get('button')
.contains('Next →')
.should('not.be.disabled')
.click()
cy.get('button').contains('Next →').should('not.be.disabled').click()
// Verify we are on next step
cy.get('article>div').should('contain', 'Register')
// Start publish process
@ -137,7 +117,7 @@ describe('Publish', () => {
cy.get('a')
.contains('See published asset')
.invoke('attr', 'href')
.then(href => {
.then((href) => {
cy.writeFile(
'cypress/fixtures/did-ipfs.txt',
href.replace('/asset/', '')

View File

@ -10,9 +10,7 @@ describe('Search', () => {
// Fill search phrase
cy.get('input#search').type('Commons Integration Test')
// Start search
cy.get('button')
.contains('Search')
.click()
cy.get('button').contains('Search').click()
// Verify there are results
cy.get('article > a', { timeout: 60000 }).should(
'have.length.greaterThan',

View File

@ -1,7 +1,7 @@
/// <reference types="Cypress" />
describe('Consume', () => {
it('should consume https:// file', () => {
cy.fixture('did').then(did => {
cy.fixture('did').then((did) => {
cy.visit(`/asset/${did}`)
})
@ -31,7 +31,7 @@ describe('Consume', () => {
})
it('should consume ipfs:// file', () => {
cy.fixture('did-ipfs').then(did => {
cy.fixture('did-ipfs').then((did) => {
cy.visit(`/asset/${did}`)
})

View File

@ -10,22 +10,16 @@ describe('Faucet', () => {
})
beforeEach(() => {
cy.get('button[name="FaucetETH"]')
.first()
.as('button')
cy.get('button[name="FaucetETH"]').first().as('button')
})
it('Faucet button is clickable when user is connected.', () => {
cy.get('@button')
.contains('Request ETH')
.should('not.be.disabled')
cy.get('@button').contains('Request ETH').should('not.be.disabled')
})
it('should execute faucet call', () => {
// Execute call
cy.get('@button')
.contains('Request ETH')
.click()
cy.get('@button').contains('Request ETH').click()
// Verify that we got response from server
cy.contains(/(Successfully added|Already requested)/, {
timeout: 60000

View File

@ -1,3 +1,3 @@
/// <reference types="Cypress" />
before(function() {})
before(function () {})

View File

@ -1,7 +1,7 @@
import request from 'supertest'
import server from '../src/server'
afterAll(done => {
afterAll((done) => {
server.close(done)
})
@ -22,12 +22,10 @@ describe('POST /api/v1/urlcheck', () => {
})
it('responds with json on ipfs://', async () => {
const response = await request(server)
.post('/api/v1/urlcheck')
.send({
url:
'ipfs://QmX5LRpEVocfks9FNDnRoK2imf2fy9mPpP4wfgaDVXWfYD/video.mp4'
})
const response = await request(server).post('/api/v1/urlcheck').send({
url:
'ipfs://QmX5LRpEVocfks9FNDnRoK2imf2fy9mPpP4wfgaDVXWfYD/video.mp4'
})
expect(response.status).toBe(200)
expect(response.body).toBeTruthy()
})