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

44 lines
1.3 KiB
TypeScript

import { assert } from 'chai'
import { config } from '../config'
import { Ocean, Account, DDO, MetaData } from '../../src' // @oceanprotocol/squid
import { getMetadata } from '../utils'
import { ServiceType } from '../../src/ddo/Service'
describe('Compute', () => {
let ocean: Ocean
let account: Account
let ddoAsset: DDO
let ddoAlgorithm: DDO
const metadataAsset = getMetadata()
const metadataAlgorithm = getMetadata(0, 'algorithm')
const assetComputeService = {
type: 'compute' as ServiceType,
index: 2,
attributes: {
main: {
serviceAgreementTemplate: {
contractName: ''
}
}
}
}
before(async () => {
ocean = await Ocean.getInstance(config)
;[account] = await ocean.accounts.list()
ddoAsset = await ocean.assets.create(metadataAsset as MetaData, account, [
assetComputeService
])
ddoAlgorithm = await ocean.assets.create(metadataAlgorithm as MetaData, account)
})
it('should order & start a compute job', async () => {
const agreementId = await ocean.compute.order(account, ddoAsset.id)
const response = await ocean.compute.start(account, agreementId, ddoAlgorithm.id)
// assert.deepEqual(response)
})
})