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

fix auth & tests

This commit is contained in:
Alex 2020-04-08 10:44:36 +03:00
parent 130c9d7938
commit 7de1b110b0
2 changed files with 21 additions and 4 deletions

View File

@ -121,10 +121,13 @@ export class Brizo extends Instantiable {
): Promise<ComputeJob | ComputeJob[]> {
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(

View File

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