1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00

fix unit tests

This commit is contained in:
Matthias Kretschmann 2019-07-10 17:29:33 +02:00
parent 01fb305612
commit 87c54d2cb8
Signed by: m
GPG Key ID: 606EEEF3C479A91F
6 changed files with 59 additions and 82 deletions

View File

@ -10,9 +10,7 @@ describe('AccountStatus', () => {
it('togglePopover fires', () => {
const { container } = render(<AccountStatus />)
const indicator = container.querySelector('.statusIndicator')
const indicator = container.querySelector('.status')
indicator && fireEvent.mouseOver(indicator)
expect(container.querySelector('.popover')).toBeInTheDocument()
indicator && fireEvent.mouseOut(indicator)

View File

@ -8,7 +8,7 @@ describe('Web3message', () => {
it('renders with burner wallet message', () => {
const { container } = render(
<User.Provider value={{ ...userMockConnected, isBurner: true }}>
<Web3message />
<Web3message extended />
</User.Provider>
)
expect(container.firstChild).toHaveTextContent('Burner Wallet')
@ -19,7 +19,7 @@ describe('Web3message', () => {
<User.Provider
value={{ ...userMockConnected, isOceanNetwork: false }}
>
<Web3message />
<Web3message extended />
</User.Provider>
)
expect(container.firstChild).toHaveTextContent(
@ -30,7 +30,7 @@ describe('Web3message', () => {
it('renders with noAccount message', () => {
const { container } = render(
<User.Provider value={{ ...userMock, isOceanNetwork: true }}>
<Web3message />
<Web3message extended />
</User.Provider>
)
expect(container.firstChild).toHaveTextContent('No wallet selected.')

View File

@ -33,14 +33,14 @@ export default class Web3message extends PureComponent<{ extended?: boolean }> {
</div>
{this.props.extended && (
<p className={styles.text}>
<div className={styles.text}>
<AccountStatus className={styles.status} />
<em
dangerouslySetInnerHTML={{
__html: this.message()
}}
/>
</p>
</div>
)}
</div>
)

View File

@ -1,9 +1,7 @@
import React from 'react'
import { render } from '@testing-library/react'
import { MemoryRouter } from 'react-router'
import { User } from '../context'
import History from './History'
import { userMock } from '../../__mocks__/user-mock'
describe('History', () => {
it('renders without crashing', () => {
@ -14,18 +12,4 @@ describe('History', () => {
)
expect(container.firstChild).toBeInTheDocument()
})
it('outputs no wallet selected', () => {
const { container } = render(
<User.Provider value={{ ...userMock, isOceanNetwork: true }}>
<MemoryRouter>
<History />
</MemoryRouter>
</User.Provider>
)
expect(container.querySelector('.message')).toBeInTheDocument()
expect(container.querySelector('.message')).toHaveTextContent(
'No wallet selected.'
)
})
})

109
package-lock.json generated
View File

@ -1487,6 +1487,12 @@
"delayed-stream": "~1.0.0"
}
},
"commander": {
"version": "2.15.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz",
"integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==",
"dev": true
},
"common-tags": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/common-tags/-/common-tags-1.8.0.tgz",
@ -1656,9 +1662,9 @@
}
},
"cypress": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/cypress/-/cypress-3.3.1.tgz",
"integrity": "sha512-JIo47ZD9P3jAw7oaK7YKUoODzszJbNw41JmBrlMMiupHOlhmXvZz75htuo7mfRFPC9/1MDQktO4lX/V2+a6lGQ==",
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/cypress/-/cypress-3.4.0.tgz",
"integrity": "sha512-vUE+sK3l23fhs5qTN3dKpveyP0fGr37VmK3FSYaTEjbqC/qh4DbA1Ych/3bLStUpHP4rpE5KAx7i1s/tpdD9vQ==",
"dev": true,
"requires": {
"@cypress/listr-verbose-renderer": "0.4.1",
@ -1674,7 +1680,7 @@
"execa": "0.10.0",
"executable": "4.1.1",
"extract-zip": "1.6.7",
"fs-extra": "4.0.1",
"fs-extra": "5.0.0",
"getos": "3.1.1",
"glob": "7.1.3",
"is-ci": "1.2.1",
@ -1687,7 +1693,7 @@
"moment": "2.24.0",
"ramda": "0.24.1",
"request": "2.88.0",
"request-progress": "0.4.0",
"request-progress": "3.0.0",
"supports-color": "5.5.0",
"tmp": "0.1.0",
"url": "0.11.0",
@ -1706,12 +1712,6 @@
"integrity": "sha512-vsGdkwSCDpWmP80ncATX7iea5DWQemg1UgCW5J8tqjU3lYw4FBYuj89J0CTVomA7BEfvSZd84GmHko+MxFQU2A==",
"dev": true
},
"commander": {
"version": "2.15.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz",
"integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==",
"dev": true
},
"debug": {
"version": "3.2.6",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
@ -1736,17 +1736,6 @@
"strip-eof": "^1.0.0"
}
},
"fs-extra": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.1.tgz",
"integrity": "sha1-f8DGyJV/mD9X8waiTlud3Y0N2IA=",
"dev": true,
"requires": {
"graceful-fs": "^4.1.2",
"jsonfile": "^3.0.0",
"universalify": "^0.1.0"
}
},
"glob": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz",
@ -1770,15 +1759,6 @@
"ci-info": "^1.5.0"
}
},
"jsonfile": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-3.0.1.tgz",
"integrity": "sha1-pezG9l9T9mLEQVx2daAzHQmS7GY=",
"dev": true,
"requires": {
"graceful-fs": "^4.1.6"
}
},
"minimist": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
@ -2788,15 +2768,6 @@
"yauzl": "2.4.1"
},
"dependencies": {
"fd-slicer": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz",
"integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=",
"dev": true,
"requires": {
"pend": "~1.2.0"
}
},
"yauzl": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.4.1.tgz",
@ -2853,9 +2824,9 @@
"dev": true
},
"fd-slicer": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz",
"integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=",
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz",
"integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=",
"dev": true,
"requires": {
"pend": "~1.2.0"
@ -2990,6 +2961,17 @@
"integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=",
"dev": true
},
"fs-extra": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-5.0.0.tgz",
"integrity": "sha512-66Pm4RYbjzdyeuqudYqhFiNBbCIuI9kgRqLPSHIlXHidW8NIQtVdkM1yeZ4lXwuhbTETv3EUGMNHAAw6hiundQ==",
"dev": true,
"requires": {
"graceful-fs": "^4.1.2",
"jsonfile": "^4.0.0",
"universalify": "^0.1.0"
}
},
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@ -4068,6 +4050,15 @@
}
}
},
"jsonfile": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
"integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
"dev": true,
"requires": {
"graceful-fs": "^4.1.6"
}
},
"jsprim": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
@ -5035,12 +5026,6 @@
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
"dev": true
},
"node-eta": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/node-eta/-/node-eta-0.1.1.tgz",
"integrity": "sha1-QGYQmzk3HHYccrfr2pqeoKXeEh8=",
"dev": true
},
"node-fetch": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz",
@ -7080,13 +7065,12 @@
}
},
"request-progress": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/request-progress/-/request-progress-0.4.0.tgz",
"integrity": "sha1-wZVOOQhqqFJpxWYLzuAUKmpw1+c=",
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/request-progress/-/request-progress-3.0.0.tgz",
"integrity": "sha1-TKdUCBx/7GP1BeT6qCWqBs1mnb4=",
"dev": true,
"requires": {
"node-eta": "^0.1.1",
"throttleit": "^0.0.2"
"throttleit": "^1.0.0"
}
},
"require-directory": {
@ -8422,9 +8406,9 @@
"dev": true
},
"throttleit": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/throttleit/-/throttleit-0.0.2.tgz",
"integrity": "sha1-z+34jmDADdlpe2H90qg0OptoDq8=",
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/throttleit/-/throttleit-1.0.0.tgz",
"integrity": "sha1-nnhYNtr0Z0MUWlmEtiaNgoUorGw=",
"dev": true
},
"through": {
@ -9272,6 +9256,17 @@
"requires": {
"buffer-crc32": "~0.2.3",
"fd-slicer": "~1.1.0"
},
"dependencies": {
"fd-slicer": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz",
"integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=",
"dev": true,
"requires": {
"pend": "~1.2.0"
}
}
}
}
}

View File

@ -31,7 +31,7 @@
"@typescript-eslint/parser": "^1.11.0",
"auto-changelog": "^1.13.0",
"concurrently": "^4.1.1",
"cypress": "^3.3.1",
"cypress": "^3.4.0",
"eslint": "^5.16.0",
"eslint-config-oceanprotocol": "^1.3.0",
"eslint-config-prettier": "^6.0.0",