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) }) })