mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
Merge branch 'master' into feature/compute
This commit is contained in:
commit
17b5b0a4ec
@ -7,8 +7,8 @@
|
|||||||
},
|
},
|
||||||
"project": [
|
"project": [
|
||||||
"./tsconfig.json",
|
"./tsconfig.json",
|
||||||
"./test/tsconfig.json",
|
"./test/unit/tsconfig.json",
|
||||||
"./integration/tsconfig.json"
|
"./test/integration/tsconfig.json"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"extends": [
|
"extends": [
|
||||||
|
@ -38,7 +38,7 @@ script:
|
|||||||
- export ETH_PORT=18545; npm run test:cover
|
- export ETH_PORT=18545; npm run test:cover
|
||||||
- npm run build
|
- npm run build
|
||||||
- npm run doc
|
- npm run doc
|
||||||
- npm run integration:cover
|
- npm run test:integration:cover
|
||||||
|
|
||||||
after_script:
|
after_script:
|
||||||
- npm run report-codacy
|
- npm run report-codacy
|
||||||
|
@ -152,7 +152,7 @@ npm run test:cover
|
|||||||
|
|
||||||
### Integration Tests
|
### Integration Tests
|
||||||
|
|
||||||
Besides a running `ganache-cli` instance, a locally running Ocean network is required. To do so before running the tests, use [Barge](https://github.com/oceanprotocol/barge):
|
A locally running Ocean network is required. To do so before running the tests, use [Barge](https://github.com/oceanprotocol/barge):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/oceanprotocol/barge
|
git clone https://github.com/oceanprotocol/barge
|
||||||
@ -176,13 +176,13 @@ Once everything is up, run the integration tests:
|
|||||||
```bash
|
```bash
|
||||||
# integration tests work with the spree network and the SEED_WORDS in previous step are required.
|
# integration tests work with the spree network and the SEED_WORDS in previous step are required.
|
||||||
# Make sure to reset `ETH_PORT` to 8545 (or whatever port is used in `spree1)
|
# Make sure to reset `ETH_PORT` to 8545 (or whatever port is used in `spree1)
|
||||||
npm run integration
|
npm run test:integration
|
||||||
```
|
```
|
||||||
|
|
||||||
to generate code coverage information during test, run:
|
to generate code coverage information during test, run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run integration:cover
|
npm run test:integration:cover
|
||||||
```
|
```
|
||||||
|
|
||||||
## Code Style
|
## Code Style
|
||||||
|
20
package.json
20
package.json
@ -12,15 +12,15 @@
|
|||||||
"build:metadata": "./scripts/get-metadata.js > src/metadata.json",
|
"build:metadata": "./scripts/get-metadata.js > src/metadata.json",
|
||||||
"build:dist": "cross-env NODE_ENV=production webpack",
|
"build:dist": "cross-env NODE_ENV=production webpack",
|
||||||
"build:watch": "tsc -w",
|
"build:watch": "tsc -w",
|
||||||
"test": "mocha",
|
"test": "mocha --opts test/unit/mocha.opts",
|
||||||
"test:watch": "mocha -w --watch-extensions js,ts,json",
|
"test:watch": "npm test -- -w --watch-extensions js,ts,json",
|
||||||
"test:cover": "nyc --report-dir coverage/unit mocha",
|
"test:cover": "nyc --report-dir coverage/unit npm test",
|
||||||
"integration": "mocha --opts integration/mocha.opts",
|
"test:integration": "mocha --opts test/integration/mocha.opts",
|
||||||
"integration:pacific": "export NETWORK_NAME=pacific; mocha --opts integration/mocha.opts",
|
"test:integration:pacific": "export NETWORK_NAME=pacific; npm run test:integration",
|
||||||
"integration:nile": "export NETWORK_NAME=nile; mocha --opts integration/mocha.opts",
|
"test:integration:nile": "export NETWORK_NAME=nile; npm run test:integration",
|
||||||
"integration:duero": "export NETWORK_NAME=duero; mocha --opts integration/mocha.opts",
|
"test:integration:duero": "export NETWORK_NAME=duero; npm run test:integration",
|
||||||
"integration:watch": "mocha -w --watch-extensions js,ts,json --opts integration/mocha.opts",
|
"test:integration:watch": "npm run test:integration -- -w --watch-extensions js,ts,json",
|
||||||
"integration:cover": "nyc --report-dir coverage/integration mocha --opts integration/mocha.opts",
|
"test:integration:cover": "nyc --report-dir coverage/integration npm run test:integration",
|
||||||
"clean": "rm -rf ./dist/ ./doc/ ./.nyc_output",
|
"clean": "rm -rf ./dist/ ./doc/ ./.nyc_output",
|
||||||
"lint": "eslint --ignore-path .gitignore --ext .ts,.tsx .",
|
"lint": "eslint --ignore-path .gitignore --ext .ts,.tsx .",
|
||||||
"format": "prettier --parser typescript --ignore-path .gitignore --write '**/*.{js,jsx,ts,tsx}'",
|
"format": "prettier --parser typescript --ignore-path .gitignore --write '**/*.{js,jsx,ts,tsx}'",
|
||||||
@ -107,7 +107,7 @@
|
|||||||
"ts-node/register"
|
"ts-node/register"
|
||||||
],
|
],
|
||||||
"reporter": [
|
"reporter": [
|
||||||
"text-summary",
|
"text",
|
||||||
"lcov",
|
"lcov",
|
||||||
"html"
|
"html"
|
||||||
],
|
],
|
||||||
|
@ -4,4 +4,4 @@
|
|||||||
--full-trace
|
--full-trace
|
||||||
--exit
|
--exit
|
||||||
--timeout 300000
|
--timeout 300000
|
||||||
integration/**/*.test.ts
|
test/integration/**/*.test.ts
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { Aquarius } from '../../src/aquarius/Aquarius'
|
import { Aquarius } from '../../../src/aquarius/Aquarius'
|
||||||
import { DDO } from '../../src/ddo/DDO'
|
import { DDO } from '../../../src/ddo/DDO'
|
||||||
import DID from '../../src/ocean/DID'
|
import DID from '../../../src/ocean/DID'
|
||||||
|
|
||||||
const ddoStore: Map<string, any> = new Map<string, any>()
|
const ddoStore: Map<string, any> = new Map<string, any>()
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
import Account from '../../src/ocean/Account'
|
import Account from '../../../src/ocean/Account'
|
||||||
import { Ocean } from '../../src/ocean/Ocean'
|
import { Ocean } from '../../../src/ocean/Ocean'
|
||||||
import config from '../config'
|
import config from '../config'
|
||||||
import ContractBaseMock from '../__mocks__/ContractBase.Mock'
|
import ContractBaseMock from '../__mocks__/ContractBase.Mock'
|
||||||
import TestContractHandler from './TestContractHandler'
|
import TestContractHandler from './TestContractHandler'
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
import { EventHandler } from '../../src/keeper/EventHandler'
|
import { EventHandler } from '../../../src/keeper/EventHandler'
|
||||||
import { ContractEventSubscription } from '../../src/keeper/ContractEvent'
|
import { ContractEventSubscription } from '../../../src/keeper/ContractEvent'
|
||||||
import { Ocean } from '../../src/ocean/Ocean'
|
import { Ocean } from '../../../src/ocean/Ocean'
|
||||||
import config from '../config'
|
import config from '../config'
|
||||||
import TestContractHandler from './TestContractHandler'
|
import TestContractHandler from './TestContractHandler'
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
import ContractHandler from '../../src/keeper/ContractHandler'
|
import ContractHandler from '../../../src/keeper/ContractHandler'
|
||||||
import { Ocean } from '../../src/ocean/Ocean'
|
import { Ocean } from '../../../src/ocean/Ocean'
|
||||||
import config from '../config'
|
import config from '../config'
|
||||||
|
|
||||||
describe('ContractHandler', () => {
|
describe('ContractHandler', () => {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
import DIDRegistry from '../../src/keeper/contracts/DIDRegistry'
|
import DIDRegistry from '../../../src/keeper/contracts/DIDRegistry'
|
||||||
import Account from '../../src/ocean/Account'
|
import Account from '../../../src/ocean/Account'
|
||||||
import { Ocean } from '../../src/ocean/Ocean'
|
import { Ocean } from '../../../src/ocean/Ocean'
|
||||||
import { generateId } from '../../src/utils/GeneratorHelpers'
|
import { generateId } from '../../../src/utils/GeneratorHelpers'
|
||||||
import config from '../config'
|
import config from '../config'
|
||||||
import TestContractHandler from './TestContractHandler'
|
import TestContractHandler from './TestContractHandler'
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
import config from '../config'
|
import config from '../config'
|
||||||
import TestContractHandler from './TestContractHandler'
|
import TestContractHandler from './TestContractHandler'
|
||||||
import Keeper from '../../src/keeper/Keeper'
|
import Keeper from '../../../src/keeper/Keeper'
|
||||||
import { Ocean } from '../../src/ocean/Ocean'
|
import { Ocean } from '../../../src/ocean/Ocean'
|
||||||
|
|
||||||
let keeper: Keeper
|
let keeper: Keeper
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { Contract } from 'web3-eth-contract'
|
import { Contract } from 'web3-eth-contract'
|
||||||
import ContractHandler from '../../src/keeper/ContractHandler'
|
import ContractHandler from '../../../src/keeper/ContractHandler'
|
||||||
import Web3Provider from '../../src/keeper/Web3Provider'
|
import Web3Provider from '../../../src/keeper/Web3Provider'
|
||||||
import Logger from '../../src/utils/Logger'
|
import Logger from '../../../src/utils/Logger'
|
||||||
import config from '../config'
|
import config from '../config'
|
||||||
|
|
||||||
interface ContractTest extends Contract {
|
interface ContractTest extends Contract {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
import { AccessSecretStoreCondition } from '../../../src/keeper/contracts/conditions'
|
import { AccessSecretStoreCondition } from '../../../../src/keeper/contracts/conditions'
|
||||||
import { Ocean } from '../../../src/ocean/Ocean'
|
import { Ocean } from '../../../../src/ocean/Ocean'
|
||||||
import config from '../../config'
|
import config from '../../config'
|
||||||
import TestContractHandler from '../TestContractHandler'
|
import TestContractHandler from '../TestContractHandler'
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
import { EscrowReward } from '../../../src/keeper/contracts/conditions'
|
import { EscrowReward } from '../../../../src/keeper/contracts/conditions'
|
||||||
import { Ocean } from '../../../src/ocean/Ocean'
|
import { Ocean } from '../../../../src/ocean/Ocean'
|
||||||
import config from '../../config'
|
import config from '../../config'
|
||||||
import TestContractHandler from '../TestContractHandler'
|
import TestContractHandler from '../TestContractHandler'
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
import { LockRewardCondition } from '../../../src/keeper/contracts/conditions'
|
import { LockRewardCondition } from '../../../../src/keeper/contracts/conditions'
|
||||||
import { Ocean } from '../../../src/ocean/Ocean'
|
import { Ocean } from '../../../../src/ocean/Ocean'
|
||||||
import config from '../../config'
|
import config from '../../config'
|
||||||
import TestContractHandler from '../TestContractHandler'
|
import TestContractHandler from '../TestContractHandler'
|
||||||
|
|
||||||
|
@ -5,4 +5,4 @@
|
|||||||
--bail
|
--bail
|
||||||
--exit
|
--exit
|
||||||
--timeout 20000
|
--timeout 20000
|
||||||
test/config.ts test/**/*.test.ts
|
test/unit/config.ts test/unit/**/*.test.ts
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
import Web3Provider from '../../src/keeper/Web3Provider'
|
import Web3Provider from '../../../src/keeper/Web3Provider'
|
||||||
import Account from '../../src/ocean/Account'
|
import Account from '../../../src/ocean/Account'
|
||||||
import { Ocean } from '../../src/ocean/Ocean'
|
import { Ocean } from '../../../src/ocean/Ocean'
|
||||||
import config from '../config'
|
import config from '../config'
|
||||||
import TestContractHandler from '../keeper/TestContractHandler'
|
import TestContractHandler from '../keeper/TestContractHandler'
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import assert from 'assert'
|
import assert from 'assert'
|
||||||
import DID from '../../src/ocean/DID'
|
import DID from '../../../src/ocean/DID'
|
||||||
|
|
||||||
describe('DID', () => {
|
describe('DID', () => {
|
||||||
describe('#generate()', () => {
|
describe('#generate()', () => {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { assert, spy, use } from 'chai'
|
import { assert, spy, use } from 'chai'
|
||||||
import spies from 'chai-spies'
|
import spies from 'chai-spies'
|
||||||
|
|
||||||
import Account from '../../src/ocean/Account'
|
import Account from '../../../src/ocean/Account'
|
||||||
import { Ocean } from '../../src/ocean/Ocean'
|
import { Ocean } from '../../../src/ocean/Ocean'
|
||||||
import config from '../config'
|
import config from '../config'
|
||||||
import TestContractHandler from '../keeper/TestContractHandler'
|
import TestContractHandler from '../keeper/TestContractHandler'
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@ import { assert, spy, use } from 'chai'
|
|||||||
import spies from 'chai-spies'
|
import spies from 'chai-spies'
|
||||||
|
|
||||||
import config from '../config'
|
import config from '../config'
|
||||||
import Account from '../../src/ocean/Account'
|
import Account from '../../../src/ocean/Account'
|
||||||
import { Ocean } from '../../src/ocean/Ocean'
|
import { Ocean } from '../../../src/ocean/Ocean'
|
||||||
import { OceanAccounts } from '../../src/ocean/OceanAccounts'
|
import { OceanAccounts } from '../../../src/ocean/OceanAccounts'
|
||||||
|
|
||||||
use(spies)
|
use(spies)
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { assert, spy, use } from 'chai'
|
import { assert, spy, use } from 'chai'
|
||||||
import spies from 'chai-spies'
|
import spies from 'chai-spies'
|
||||||
|
|
||||||
import { SearchQuery } from '../../src/aquarius/Aquarius'
|
import { SearchQuery } from '../../../src/aquarius/Aquarius'
|
||||||
import { Ocean } from '../../src/ocean/Ocean'
|
import { Ocean } from '../../../src/ocean/Ocean'
|
||||||
import config from '../config'
|
import config from '../config'
|
||||||
|
|
||||||
use(spies)
|
use(spies)
|
||||||
|
@ -2,9 +2,9 @@ import { assert, expect, spy, use } from 'chai'
|
|||||||
import spies from 'chai-spies'
|
import spies from 'chai-spies'
|
||||||
|
|
||||||
import config from '../config'
|
import config from '../config'
|
||||||
import Account from '../../src/ocean/Account'
|
import Account from '../../../src/ocean/Account'
|
||||||
import { Ocean } from '../../src/ocean/Ocean'
|
import { Ocean } from '../../../src/ocean/Ocean'
|
||||||
import { OceanAuth } from '../../src/ocean/OceanAuth'
|
import { OceanAuth } from '../../../src/ocean/OceanAuth'
|
||||||
|
|
||||||
use(spies)
|
use(spies)
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { assert, expect, spy, use } from 'chai'
|
import { assert, expect, spy, use } from 'chai'
|
||||||
import spies from 'chai-spies'
|
import spies from 'chai-spies'
|
||||||
|
|
||||||
import Account from '../../src/ocean/Account'
|
import Account from '../../../src/ocean/Account'
|
||||||
import { Ocean } from '../../src/ocean/Ocean'
|
import { Ocean } from '../../../src/ocean/Ocean'
|
||||||
import { OceanSecretStore } from '../../src/ocean/OceanSecretStore'
|
import { OceanSecretStore } from '../../../src/ocean/OceanSecretStore'
|
||||||
import config from '../config'
|
import config from '../config'
|
||||||
|
|
||||||
use(spies)
|
use(spies)
|
||||||
|
@ -3,7 +3,7 @@ import spies from 'chai-spies'
|
|||||||
import Web3 from 'web3'
|
import Web3 from 'web3'
|
||||||
import config from '../../config'
|
import config from '../../config'
|
||||||
|
|
||||||
import { Ocean } from '../../../src/ocean/Ocean'
|
import { Ocean } from '../../../../src/ocean/Ocean'
|
||||||
|
|
||||||
use(spies)
|
use(spies)
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import {
|
|||||||
noZeroX,
|
noZeroX,
|
||||||
didPrefixed,
|
didPrefixed,
|
||||||
noDidPrefixed
|
noDidPrefixed
|
||||||
} from '../../src/utils/ConversionTypeHelpers'
|
} from '../../../src/utils/ConversionTypeHelpers'
|
||||||
|
|
||||||
describe('ConversionTypeHelpers', () => {
|
describe('ConversionTypeHelpers', () => {
|
||||||
describe('#zeroXTransformer()', () => {
|
describe('#zeroXTransformer()', () => {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { assert } from 'chai'
|
import { assert } from 'chai'
|
||||||
import { generateId } from '../../src/utils/GeneratorHelpers'
|
import { generateId } from '../../../src/utils/GeneratorHelpers'
|
||||||
|
|
||||||
describe('GeneratorHelpers', () => {
|
describe('GeneratorHelpers', () => {
|
||||||
describe('#generateId()', () => {
|
describe('#generateId()', () => {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { assert, expect, spy, use } from 'chai'
|
import { assert, expect, spy, use } from 'chai'
|
||||||
import spies from 'chai-spies'
|
import spies from 'chai-spies'
|
||||||
|
|
||||||
import { SubscribableObserver } from '../../src/utils/SubscribableObserver'
|
import { SubscribableObserver } from '../../../src/utils/SubscribableObserver'
|
||||||
|
|
||||||
use(spies)
|
use(spies)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user