Skip to content

Commit

Permalink
test updates
Browse files Browse the repository at this point in the history
  • Loading branch information
kremalicious committed Sep 8, 2020
1 parent 971af55 commit 47d1f4d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
31 changes: 15 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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'",
Expand Down
2 changes: 1 addition & 1 deletion test/unit/metadatastore/MetadataStore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 47d1f4d

Please sign in to comment.