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

add integration test for compute with a rawcode algo

This commit is contained in:
Klaudiusz Dembler 2020-03-16 13:40:43 +01:00
parent 418e2fadb2
commit 40b2ccffea
No known key found for this signature in database
GPG Key ID: 14B9FB649EE34C35

View File

@ -1,7 +1,15 @@
import { assert } from 'chai'
import { config } from '../config'
import { Ocean, Account, DDO, MetaData, ComputeJobStatus, Config } from '../../../src'
import {
Ocean,
Account,
DDO,
MetaData,
ComputeJobStatus,
Config,
MetaDataAlgorithm
} from '../../../src'
import { getMetadata, createComputeService } from '../utils'
import { ServiceCompute } from '../../../src/ddo/Service'
@ -88,9 +96,28 @@ describe('Compute', () => {
} catch {}
})
it('should start a compute job', async () => {
it('should start a compute job with a published algo', async () => {
const response = await ocean.compute.start(account, agreementId, algorithm.id)
assert.equal(response.status, ComputeJobStatus.Started)
})
it('should start a compute job with a rawcode algo', async () => {
const algoMeta: MetaDataAlgorithm = {
rawcode: `console.log('Hello world!')`,
container: {
entrypoint: 'node $ALGO',
image: 'node',
tag: '10'
}
}
const response = await ocean.compute.start(
account,
agreementId,
undefined,
algoMeta
)
assert.equal(response.status, ComputeJobStatus.Started)
})
})