diff --git a/README.md b/README.md index 54c6f9424..60957b72e 100644 --- a/README.md +++ b/README.md @@ -85,16 +85,25 @@ npm run format Test suite for unit & integration tests is setup with [Mocha](https://mochajs.org) as test runner, and [nyc](https://github.com/istanbuljs/nyc) for coverage reporting. A combined coverage report is sent to CodeClimate via Travis. -### Unit Tests +Running all tests requires running Ocean Protocol components beforehand with [Barge](https://github.com/oceanprotocol/barge), which also runs a `ganache-cli` instance: -Running unit tests requires running Ganache beforehand: +```bash +git clone https://github.com/oceanprotocol/barge +cd barge +git checkout v3 +export PROVIDER_VERSION=latest +./start_ocean.sh --no-dashboard +``` + +You can then proceed to run in another terminal, executing linting, type checking, unit, and integration tests with coverage reporting all in one go: ```bash -npm i -g ganache-cli -ganache-cli +npm test ``` -After that is running you can execute the unit tests in another terminal: +### Unit Tests + +You can execute the unit tests individually with: ```bash npm run test:unit @@ -104,17 +113,7 @@ npm run test:unit:coverage ### Integration Tests -Running integration tests requires running Ocean Protocol components beforehand with [Barge](https://github.com/oceanprotocol/barge): - -```bash -git clone https://github.com/oceanprotocol/barge -cd barge -git checkout v3 -export PROVIDER_VERSION=latest -bash -x start_ocean.sh --no-dashboard 2>&1 > start_ocean.log -``` - -After that is running you can execute the integration tests in another terminal: +You can execute the integration tests individually with: ```bash npm run test:integration diff --git a/package.json b/package.json index 3001d72e0..80b844625 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "release": "release-it --non-interactive", "changelog": "auto-changelog -p", "prepublishOnly": "npm run build", + "test": "npm run lint && npm run test:unit:cover && npm run test:integration:cover", "test:unit": "mocha --config=test/unit/.mocharc.json --node-env=test --exit 'test/unit/**/*.test.ts'", "test:unit:cover": "nyc --report-dir coverage/unit npm run test:unit", "test:integration": "mocha --config=test/integration/.mocharc.json --node-env=test --exit 'test/integration/**/*.test.ts'", diff --git a/test/unit/metadatastore/MetadataStore.test.ts b/test/unit/metadatastore/MetadataStore.test.ts index 66d354b7d..a0e03e96c 100644 --- a/test/unit/metadatastore/MetadataStore.test.ts +++ b/test/unit/metadatastore/MetadataStore.test.ts @@ -60,7 +60,7 @@ describe('MetadataStore', () => { it('should query metadata with a new instance', async () => { const metadatastoreNew = new MetadataStore(config.metadataStoreUri, LoggerInstance) - spy.on(metadatastoreNew.fetch, 'get', () => reponsify(getResults([new DDO()]))) + spy.on(metadatastoreNew.fetch, 'post', () => reponsify(getResults([new DDO()]))) const result = await metadatastoreNew.queryMetadata(query) assert.typeOf(result.results, 'array')