From 7de1b110b0c1c3cd46de153b87db911e677be599 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 8 Apr 2020 10:44:36 +0300 Subject: [PATCH] fix auth & tests --- src/brizo/Brizo.ts | 11 +++++++---- test/integration/ocean/Compute.test.ts | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/brizo/Brizo.ts b/src/brizo/Brizo.ts index bbb3e29..e5c20cb 100644 --- a/src/brizo/Brizo.ts +++ b/src/brizo/Brizo.ts @@ -121,10 +121,13 @@ export class Brizo extends Instantiable { ): Promise { const signature = await this.createSignature(consumerAccount, serviceAgreementId) const address = consumerAccount.getId() - const serviceEndpoint = await this.getEndpointFromAgreement( - 'compute', - serviceAgreementId - ) + let serviceEndpoint + if (serviceAgreementId) + serviceEndpoint = await this.getEndpointFromAgreement( + 'compute', + serviceAgreementId + ) + else serviceEndpoint = await this.getComputeEndpoint() if (!serviceEndpoint) { throw new Error( diff --git a/test/integration/ocean/Compute.test.ts b/test/integration/ocean/Compute.test.ts index 965221a..d0c8847 100644 --- a/test/integration/ocean/Compute.test.ts +++ b/test/integration/ocean/Compute.test.ts @@ -33,6 +33,7 @@ describe('Compute', () => { let dataset: DDO let algorithm: DDO let computeService: ServiceCompute + let jobId: string before(async () => { ocean = await Ocean.getInstance(customConfig) @@ -117,5 +118,18 @@ describe('Compute', () => { ) assert.equal(response.status, ComputeJobStatus.Started) + jobId = response.jobId + }) + + it('should get status of a compute job', async () => { + const response = await ocean.compute.status(account, agreementId, jobId) + + assert.equal(response[0].jobId, jobId) + }) + + it('should get status of all compute jobs for an address', async () => { + const response = await ocean.compute.status(account, undefined, undefined) + + assert.isAbove(response.length, 0) }) })