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 ? ( {isBurner ? (
<button <button
className={styles.toggle} className={styles.toggle}
onClick={event => this.toggleAccountInfo(event)} onClick={(event) => this.toggleAccountInfo(event)}
title="Show More Account Info" title="Show More Account Info"
> >
<Caret <Caret

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -148,7 +148,7 @@ export default class VersionNumbers extends PureComponent<
return ( return (
<Market.Consumer> <Market.Consumer>
{market => ( {(market) => (
<p className={styles.versionsMinimal}> <p className={styles.versionsMinimal}>
<a <a
title={`${squid.name} v${squid.version}\n${brizo.name} v${brizo.version}\n${aquarius.name} v${aquarius.version}`} 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 {results
.slice(0, recent || undefined) .slice(0, recent || undefined)
.filter(asset => !!asset) .filter((asset) => !!asset)
.map((asset: any) => ( .map((asset: any) => (
<AssetTeaser <AssetTeaser
list={list} list={list}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -143,7 +143,7 @@ class Publish extends Component<{}, PublishState> {
// Setting state for all fields // Setting state for all fields
if (hasContent) { if (hasContent) {
this.setState( this.setState(
prevState => ({ (prevState) => ({
validationStatus: { validationStatus: {
...prevState.validationStatus, ...prevState.validationStatus,
[this.state.currentStep]: { [this.state.currentStep]: {
@ -158,7 +158,7 @@ class Publish extends Component<{}, PublishState> {
) )
} else { } else {
this.setState( this.setState(
prevState => ({ (prevState) => ({
validationStatus: { validationStatus: {
...prevState.validationStatus, ...prevState.validationStatus,
[this.state.currentStep]: { [this.state.currentStep]: {
@ -180,7 +180,7 @@ class Publish extends Component<{}, PublishState> {
// Step 1 // Step 1
// //
if (validationStatus[1].name && validationStatus[1].files) { if (validationStatus[1].name && validationStatus[1].files) {
this.setState(prevState => ({ this.setState((prevState) => ({
validationStatus: { validationStatus: {
...prevState.validationStatus, ...prevState.validationStatus,
1: { 1: {
@ -190,7 +190,7 @@ class Publish extends Component<{}, PublishState> {
} }
})) }))
} else { } else {
this.setState(prevState => ({ this.setState((prevState) => ({
validationStatus: { validationStatus: {
...prevState.validationStatus, ...prevState.validationStatus,
1: { 1: {
@ -205,7 +205,7 @@ class Publish extends Component<{}, PublishState> {
// Step 2 // Step 2
// //
if (validationStatus[2].description && validationStatus[2].categories) { if (validationStatus[2].description && validationStatus[2].categories) {
this.setState(prevState => ({ this.setState((prevState) => ({
validationStatus: { validationStatus: {
...prevState.validationStatus, ...prevState.validationStatus,
2: { 2: {
@ -215,7 +215,7 @@ class Publish extends Component<{}, PublishState> {
} }
})) }))
} else { } else {
this.setState(prevState => ({ this.setState((prevState) => ({
validationStatus: { validationStatus: {
...prevState.validationStatus, ...prevState.validationStatus,
2: { 2: {
@ -234,7 +234,7 @@ class Publish extends Component<{}, PublishState> {
validationStatus[3].copyrightHolder && validationStatus[3].copyrightHolder &&
validationStatus[3].license validationStatus[3].license
) { ) {
this.setState(prevState => ({ this.setState((prevState) => ({
validationStatus: { validationStatus: {
...prevState.validationStatus, ...prevState.validationStatus,
3: { 3: {
@ -244,7 +244,7 @@ class Publish extends Component<{}, PublishState> {
} }
})) }))
} else { } else {
this.setState(prevState => ({ this.setState((prevState) => ({
validationStatus: { validationStatus: {
...prevState.validationStatus, ...prevState.validationStatus,
3: { 3: {
@ -337,7 +337,7 @@ class Publish extends Component<{}, PublishState> {
public render() { public render() {
return ( return (
<Market.Consumer> <Market.Consumer>
{market => ( {(market) => (
<Route <Route
title="Publish" title="Publish"
description={`Publish a new data set into the Ocean Protocol ${market.network} Network.`} 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) { function registerValidSW(swUrl: string, config?: Config) {
navigator.serviceWorker navigator.serviceWorker
.register(swUrl) .register(swUrl)
.then(registration => { .then((registration) => {
registration.onupdatefound = () => { registration.onupdatefound = () => {
const installingWorker = registration.installing const installingWorker = registration.installing
if (installingWorker == null) { 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) console.error('Error during service worker registration:', error)
}) })
} }
@ -111,7 +111,7 @@ function registerValidSW(swUrl: string, config?: Config) {
function checkValidServiceWorker(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. // Check if the service worker can be found. If it can't reload the page.
fetch(swUrl) fetch(swUrl)
.then(response => { .then((response) => {
// Ensure service worker exists, and that we really are getting a JS file. // Ensure service worker exists, and that we really are getting a JS file.
const contentType = response.headers.get('content-type') const contentType = response.headers.get('content-type')
if ( if (
@ -120,7 +120,7 @@ function checkValidServiceWorker(swUrl: string, config?: Config) {
contentType.indexOf('javascript') === -1) contentType.indexOf('javascript') === -1)
) { ) {
// No service worker found. Probably a different app. Reload the page. // No service worker found. Probably a different app. Reload the page.
navigator.serviceWorker.ready.then(registration => { navigator.serviceWorker.ready.then((registration) => {
registration.unregister().then(() => { registration.unregister().then(() => {
window.location.reload() window.location.reload()
}) })
@ -139,7 +139,7 @@ function checkValidServiceWorker(swUrl: string, config?: Config) {
export function unregister() { export function unregister() {
if ('serviceWorker' in navigator) { if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready.then(registration => { navigator.serviceWorker.ready.then((registration) => {
registration.unregister() registration.unregister()
}) })
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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