1
0
mirror of https://github.com/oceanprotocol-archive/squid-js.git synced 2024-02-02 15:31:51 +01:00

consolidate test files

This commit is contained in:
Matthias Kretschmann 2020-01-30 22:08:18 +01:00
parent db6864d921
commit 078c35146f
Signed by: m
GPG Key ID: 606EEEF3C479A91F
55 changed files with 94 additions and 94 deletions

View File

@ -7,8 +7,8 @@
},
"project": [
"./tsconfig.json",
"./test/tsconfig.json",
"./integration/tsconfig.json"
"./test/unit/tsconfig.json",
"./test/integration/tsconfig.json"
]
},
"extends": [

View File

@ -38,7 +38,7 @@ script:
- export ETH_PORT=18545; npm run test:cover
- npm run build
- npm run doc
- npm run integration:cover
- npm run test:integration:cover
after_script:
- npm run report-codacy

View File

@ -152,7 +152,7 @@ npm run test:cover
### 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
git clone https://github.com/oceanprotocol/barge
@ -176,13 +176,13 @@ Once everything is up, run the integration tests:
```bash
# 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)
npm run integration
npm run test:integration
```
to generate code coverage information during test, run:
```bash
npm run integration:cover
npm run test:integration:cover
```
## Code Style

View File

@ -12,15 +12,15 @@
"build:metadata": "./scripts/get-metadata.js > src/metadata.json",
"build:dist": "cross-env NODE_ENV=production webpack",
"build:watch": "tsc -w",
"test": "mocha",
"test:watch": "mocha -w --watch-extensions js,ts,json",
"test:cover": "nyc --report-dir coverage/unit mocha",
"integration": "mocha --opts integration/mocha.opts",
"integration:pacific": "export NETWORK_NAME=pacific; mocha --opts integration/mocha.opts",
"integration:nile": "export NETWORK_NAME=nile; mocha --opts integration/mocha.opts",
"integration:duero": "export NETWORK_NAME=duero; mocha --opts integration/mocha.opts",
"integration:watch": "mocha -w --watch-extensions js,ts,json --opts integration/mocha.opts",
"integration:cover": "nyc --report-dir coverage/integration mocha --opts integration/mocha.opts",
"test": "mocha --opts test/unit/mocha.opts",
"test:watch": "npm test -- -w --watch-extensions js,ts,json",
"test:cover": "nyc --report-dir coverage/unit npm test",
"test:integration": "mocha --opts test/integration/mocha.opts",
"test:integration:pacific": "export NETWORK_NAME=pacific; npm run test:integration",
"test:integration:nile": "export NETWORK_NAME=nile; npm run test:integration",
"test:integration:duero": "export NETWORK_NAME=duero; npm run test:integration",
"test:integration:watch": "npm run test:integration -- -w --watch-extensions js,ts,json",
"test:integration:cover": "nyc --report-dir coverage/integration npm run test:integration",
"clean": "rm -rf ./dist/ ./doc/ ./.nyc_output",
"lint": "eslint --ignore-path .gitignore --ext .ts,.tsx .",
"format": "prettier --parser typescript --ignore-path .gitignore --write '**/*.{js,jsx,ts,tsx}'",
@ -105,7 +105,7 @@
"ts-node/register"
],
"reporter": [
"text-summary",
"text",
"lcov",
"html"
],

View File

@ -1,4 +1,4 @@
import { Config } from '../src'
import { Config } from '../../src'
import HDWalletProvider from '@truffle/hdwallet-provider'
const configJson: Config = {

View File

@ -4,4 +4,4 @@
--full-trace
--exit
--timeout 300000
integration/**/*.test.ts
test/integration/**/*.test.ts

View File

@ -1,7 +1,7 @@
import { assert } from 'chai'
import { config } from '../config'
import { getMetadata } from '../utils'
import { Ocean, Account } from '../../src' // @oceanprotocol/squid
import { Ocean, Account } from '../../../src' // @oceanprotocol/squid
describe('Asset Owners', () => {
let ocean: Ocean

View File

@ -1,6 +1,6 @@
import { assert } from 'chai'
import { config } from '../config'
import { Ocean, Account } from '../../src' // @oceanprotocol/squid
import { Ocean, Account } from '../../../src' // @oceanprotocol/squid
describe('Authentication Token', () => {
let ocean: Ocean

View File

@ -4,7 +4,7 @@ import * as fs from 'fs'
import { config } from '../config'
import { getMetadata } from '../utils'
import { Ocean, DDO, Account, ConditionState } from '../../src' // @oceanprotocol/squid
import { Ocean, DDO, Account, ConditionState } from '../../../src' // @oceanprotocol/squid
describe('Consume Asset', () => {
let ocean: Ocean

View File

@ -4,7 +4,7 @@ import * as fs from 'fs'
import { config } from '../config'
import { getMetadata } from '../utils'
import { Ocean, Account, DDO } from '../../src' // @oceanprotocol/squid
import { Ocean, Account, DDO } from '../../../src' // @oceanprotocol/squid
describe('Consume Asset (Brizo)', () => {
let ocean: Ocean

View File

@ -4,7 +4,7 @@ import * as fs from 'fs'
import { config } from '../config'
import { getMetadata } from '../utils'
import { Ocean, Account, DDO } from '../../src' // @oceanprotocol/squid
import { Ocean, Account, DDO } from '../../../src' // @oceanprotocol/squid
// Ensure that your network is fast enought and you have some free ram before run it.
xdescribe('Consume Asset (Large size)', () => {

View File

@ -2,7 +2,7 @@ import { assert } from 'chai'
import { config } from '../config'
import { Ocean, templates, conditions, utils, Account, Keeper } from '../../src' // @oceanprotocol/squid
import { Ocean, templates, conditions, utils, Account, Keeper } from '../../../src' // @oceanprotocol/squid
const { LockRewardCondition, EscrowReward, AccessSecretStoreCondition } = conditions

View File

@ -2,7 +2,7 @@ import { assert } from 'chai'
import { config } from '../config'
import { Ocean, templates, conditions, utils, Account, Keeper } from '../../src' // @oceanprotocol/squid
import { Ocean, templates, conditions, utils, Account, Keeper } from '../../../src' // @oceanprotocol/squid
const { LockRewardCondition, EscrowReward, ComputeExecutionCondition } = conditions

View File

@ -4,7 +4,7 @@ import { config } from '../config'
import { generateMetadata } from '../utils'
import { Ocean, Account, DDO } from '../../src' // @oceanprotocol/squid
import { Ocean, Account, DDO } from '../../../src' // @oceanprotocol/squid
describe('Search Asset', () => {
let ocean: Ocean

View File

@ -2,7 +2,7 @@ import { assert } from 'chai'
import { config } from '../config'
import { Ocean, Account, DID } from '../../src' // @oceanprotocol/squid
import { Ocean, Account, DID } from '../../../src' // @oceanprotocol/squid
describe('Secret Store', () => {
let ocean: Ocean

View File

@ -2,7 +2,7 @@ import { assert } from 'chai'
import { config } from '../config'
import { Ocean, Account, DDO } from '../../src' // @oceanprotocol/squid
import { Ocean, Account, DDO } from '../../../src' // @oceanprotocol/squid
// WARN: not integration test. It has been done here because constant values
// depends on the first account on spree (only accessible from integration test)

View File

@ -2,7 +2,7 @@ import { assert } from 'chai'
import { config } from '../config'
import { Ocean, OceanPlatformTechStatus } from '../../src' // @oceanprotocol/squid
import { Ocean, OceanPlatformTechStatus } from '../../../src' // @oceanprotocol/squid
describe('Versions', () => {
let ocean: Ocean

View File

@ -1,4 +1,4 @@
import { MetaData } from '../../src' // @oceanprotocol/squid
import { MetaData } from '../../../src' // @oceanprotocol/squid
const metadata: Partial<MetaData> = {
main: {

View File

@ -1,5 +1,5 @@
import assert from 'assert'
import * as squid from '../src/squid'
import * as squid from '../../src/squid'
describe('Squid', () => {
describe('interface', () => {

View File

@ -1,4 +1,4 @@
import { generateId } from '../src/utils/GeneratorHelpers'
import { generateId } from '../../src/utils/GeneratorHelpers'
export default class TestIdGenerator {
public static generatePrefixedId() {

View File

@ -1,11 +1,11 @@
import { assert, spy, use } from 'chai'
import spies from 'chai-spies'
import { Ocean } from '../../src/ocean/Ocean'
import { Aquarius, SearchQuery } from '../../src/aquarius/Aquarius'
import { DDO } from '../../src/ddo/DDO'
import DID from '../../src/ocean/DID'
import { Ocean } from '../../../src/ocean/Ocean'
import { Aquarius, SearchQuery } from '../../../src/aquarius/Aquarius'
import { DDO } from '../../../src/ddo/DDO'
import DID from '../../../src/ocean/DID'
import config from '../config'
import { LoggerInstance } from '../../src/utils'
import { LoggerInstance } from '../../../src/utils'
use(spies)

View File

@ -1,5 +1,5 @@
import { Config, LogLevel } from '../src/models/Config'
import { LoggerInstance } from '../src/utils'
import { Config, LogLevel } from '../../src/models/Config'
import { LoggerInstance } from '../../src/utils'
LoggerInstance.setLevel(LogLevel.Error)

View File

@ -1,9 +1,9 @@
import { assert, expect, spy, use } from 'chai'
import spies from 'chai-spies'
import { DDO } from '../../src/ddo/DDO'
import { Service } from '../../src/ddo/Service'
import { Ocean } from '../../src/ocean/Ocean'
import { DDO } from '../../../src/ddo/DDO'
import { Service } from '../../../src/ddo/Service'
import { Ocean } from '../../../src/ocean/Ocean'
import config from '../config'
import TestContractHandler from '../keeper/TestContractHandler'

View File

@ -1,6 +1,6 @@
import { assert } from 'chai'
import Account from '../../src/ocean/Account'
import { Ocean } from '../../src/ocean/Ocean'
import Account from '../../../src/ocean/Account'
import { Ocean } from '../../../src/ocean/Ocean'
import config from '../config'
import ContractBaseMock from '../mocks/ContractBase.Mock'
import TestContractHandler from './TestContractHandler'

View File

@ -1,7 +1,7 @@
import { assert } from 'chai'
import { EventHandler } from '../../src/keeper/EventHandler'
import { ContractEventSubscription } from '../../src/keeper/ContractEvent'
import { Ocean } from '../../src/ocean/Ocean'
import { EventHandler } from '../../../src/keeper/EventHandler'
import { ContractEventSubscription } from '../../../src/keeper/ContractEvent'
import { Ocean } from '../../../src/ocean/Ocean'
import config from '../config'
import TestContractHandler from './TestContractHandler'

View File

@ -1,6 +1,6 @@
import { assert } from 'chai'
import ContractHandler from '../../src/keeper/ContractHandler'
import { Ocean } from '../../src/ocean/Ocean'
import ContractHandler from '../../../src/keeper/ContractHandler'
import { Ocean } from '../../../src/ocean/Ocean'
import config from '../config'
describe('ContractHandler', () => {

View File

@ -1,8 +1,8 @@
import { assert } from 'chai'
import DIDRegistry from '../../src/keeper/contracts/DIDRegistry'
import Account from '../../src/ocean/Account'
import { Ocean } from '../../src/ocean/Ocean'
import { generateId } from '../../src/utils/GeneratorHelpers'
import DIDRegistry from '../../../src/keeper/contracts/DIDRegistry'
import Account from '../../../src/ocean/Account'
import { Ocean } from '../../../src/ocean/Ocean'
import { generateId } from '../../../src/utils/GeneratorHelpers'
import config from '../config'
import TestContractHandler from './TestContractHandler'

View File

@ -1,7 +1,7 @@
import { assert, expect, spy, use } from 'chai'
import spies from 'chai-spies'
import { EventHandler } from '../../src/keeper/EventHandler'
import { Ocean } from '../../src/ocean/Ocean'
import { EventHandler } from '../../../src/keeper/EventHandler'
import { Ocean } from '../../../src/ocean/Ocean'
import config from '../config'
use(spies)

View File

@ -1,8 +1,8 @@
import { assert } from 'chai'
import config from '../config'
import TestContractHandler from './TestContractHandler'
import Keeper from '../../src/keeper/Keeper'
import { Ocean } from '../../src/ocean/Ocean'
import Keeper from '../../../src/keeper/Keeper'
import { Ocean } from '../../../src/ocean/Ocean'
let keeper: Keeper

View File

@ -1,7 +1,7 @@
import { Contract } from 'web3-eth-contract'
import ContractHandler from '../../src/keeper/ContractHandler'
import Web3Provider from '../../src/keeper/Web3Provider'
import Logger from '../../src/utils/Logger'
import ContractHandler from '../../../src/keeper/ContractHandler'
import Web3Provider from '../../../src/keeper/Web3Provider'
import Logger from '../../../src/utils/Logger'
import config from '../config'
interface ContractTest extends Contract {

View File

@ -1,6 +1,6 @@
import { assert } from 'chai'
import { AccessSecretStoreCondition } from '../../../src/keeper/contracts/conditions'
import { Ocean } from '../../../src/ocean/Ocean'
import { AccessSecretStoreCondition } from '../../../../src/keeper/contracts/conditions'
import { Ocean } from '../../../../src/ocean/Ocean'
import config from '../../config'
import TestContractHandler from '../TestContractHandler'

View File

@ -1,6 +1,6 @@
import { assert } from 'chai'
import { EscrowReward } from '../../../src/keeper/contracts/conditions'
import { Ocean } from '../../../src/ocean/Ocean'
import { EscrowReward } from '../../../../src/keeper/contracts/conditions'
import { Ocean } from '../../../../src/ocean/Ocean'
import config from '../../config'
import TestContractHandler from '../TestContractHandler'

View File

@ -1,6 +1,6 @@
import { assert } from 'chai'
import { LockRewardCondition } from '../../../src/keeper/contracts/conditions'
import { Ocean } from '../../../src/ocean/Ocean'
import { LockRewardCondition } from '../../../../src/keeper/contracts/conditions'
import { Ocean } from '../../../../src/ocean/Ocean'
import config from '../../config'
import TestContractHandler from '../TestContractHandler'

View File

@ -5,4 +5,4 @@
--bail
--exit
--timeout 20000
test/config.ts test/**/*.test.ts
test/unit/config.ts test/unit/**/*.test.ts

View File

@ -1,6 +1,6 @@
import { Aquarius } from '../../src/aquarius/Aquarius'
import { DDO } from '../../src/ddo/DDO'
import DID from '../../src/ocean/DID'
import { Aquarius } from '../../../src/aquarius/Aquarius'
import { DDO } from '../../../src/ddo/DDO'
import DID from '../../../src/ocean/DID'
const ddoStore: Map<string, any> = new Map<string, any>()

View File

@ -1,4 +1,4 @@
import { Brizo } from '../../src/brizo/Brizo'
import { Brizo } from '../../../src/brizo/Brizo'
export default class BrizoMock extends Brizo {
public async initializeServiceAgreement(

View File

@ -1,4 +1,4 @@
import ContractBase from '../../src/keeper/contracts/ContractBase'
import ContractBase from '../../../src/keeper/contracts/ContractBase'
export default class ContractBaseMock extends ContractBase {
public async initMock(config: any) {

View File

@ -1,7 +1,7 @@
import { assert } from 'chai'
import Web3Provider from '../../src/keeper/Web3Provider'
import Account from '../../src/ocean/Account'
import { Ocean } from '../../src/ocean/Ocean'
import Web3Provider from '../../../src/keeper/Web3Provider'
import Account from '../../../src/ocean/Account'
import { Ocean } from '../../../src/ocean/Ocean'
import config from '../config'
import TestContractHandler from '../keeper/TestContractHandler'

View File

@ -1,5 +1,5 @@
import assert from 'assert'
import DID from '../../src/ocean/DID'
import DID from '../../../src/ocean/DID'
describe('DID', () => {
describe('#generate()', () => {

View File

@ -1,8 +1,8 @@
import { assert, spy, use } from 'chai'
import spies from 'chai-spies'
import Account from '../../src/ocean/Account'
import { Ocean } from '../../src/ocean/Ocean'
import Account from '../../../src/ocean/Account'
import { Ocean } from '../../../src/ocean/Ocean'
import config from '../config'
import TestContractHandler from '../keeper/TestContractHandler'

View File

@ -2,9 +2,9 @@ import { assert, spy, use } from 'chai'
import spies from 'chai-spies'
import config from '../config'
import Account from '../../src/ocean/Account'
import { Ocean } from '../../src/ocean/Ocean'
import { OceanAccounts } from '../../src/ocean/OceanAccounts'
import Account from '../../../src/ocean/Account'
import { Ocean } from '../../../src/ocean/Ocean'
import { OceanAccounts } from '../../../src/ocean/OceanAccounts'
use(spies)

View File

@ -1,8 +1,8 @@
import { assert, spy, use } from 'chai'
import spies from 'chai-spies'
import { SearchQuery } from '../../src/aquarius/Aquarius'
import { Ocean } from '../../src/ocean/Ocean'
import { SearchQuery } from '../../../src/aquarius/Aquarius'
import { Ocean } from '../../../src/ocean/Ocean'
import config from '../config'
use(spies)

View File

@ -2,9 +2,9 @@ import { assert, expect, spy, use } from 'chai'
import spies from 'chai-spies'
import config from '../config'
import Account from '../../src/ocean/Account'
import { Ocean } from '../../src/ocean/Ocean'
import { OceanAuth } from '../../src/ocean/OceanAuth'
import Account from '../../../src/ocean/Account'
import { Ocean } from '../../../src/ocean/Ocean'
import { OceanAuth } from '../../../src/ocean/OceanAuth'
use(spies)

View File

@ -1,9 +1,9 @@
import { assert, expect, spy, use } from 'chai'
import spies from 'chai-spies'
import Account from '../../src/ocean/Account'
import { Ocean } from '../../src/ocean/Ocean'
import { OceanSecretStore } from '../../src/ocean/OceanSecretStore'
import Account from '../../../src/ocean/Account'
import { Ocean } from '../../../src/ocean/Ocean'
import { OceanSecretStore } from '../../../src/ocean/OceanSecretStore'
import config from '../config'
use(spies)

View File

@ -3,7 +3,7 @@ import spies from 'chai-spies'
import Web3 from 'web3'
import config from '../../config'
import { Ocean } from '../../../src/ocean/Ocean'
import { Ocean } from '../../../../src/ocean/Ocean'
use(spies)

View File

@ -4,7 +4,7 @@ import {
noZeroX,
didPrefixed,
noDidPrefixed
} from '../../src/utils/ConversionTypeHelpers'
} from '../../../src/utils/ConversionTypeHelpers'
describe('ConversionTypeHelpers', () => {
describe('#zeroXTransformer()', () => {

View File

@ -1,5 +1,5 @@
import { assert } from 'chai'
import { generateId } from '../../src/utils/GeneratorHelpers'
import { generateId } from '../../../src/utils/GeneratorHelpers'
describe('GeneratorHelpers', () => {
describe('#generateId()', () => {

View File

@ -1,7 +1,7 @@
import { assert, expect, spy, use } from 'chai'
import spies from 'chai-spies'
import { SubscribableObserver } from '../../src/utils/SubscribableObserver'
import { SubscribableObserver } from '../../../src/utils/SubscribableObserver'
use(spies)

View File

@ -1,7 +1,7 @@
import { assert, expect, spy, use } from 'chai'
import spies from 'chai-spies'
import { SubscribablePromise } from '../../src/utils/SubscribablePromise'
import { SubscribablePromise } from '../../../src/utils/SubscribablePromise'
use(spies)