From 1336036067af0c6f74df40bc7dc51049148dd0c1 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 29 Jan 2020 20:24:28 +0100 Subject: [PATCH] test tweaks --- integration/ocean/Compute.test.ts | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/integration/ocean/Compute.test.ts b/integration/ocean/Compute.test.ts index 54debfd..617fac0 100644 --- a/integration/ocean/Compute.test.ts +++ b/integration/ocean/Compute.test.ts @@ -4,16 +4,16 @@ import { config } from '../config' import { Ocean, Account, DDO, MetaData, ComputeJobStatus } from '../../src' // @oceanprotocol/squid import { getMetadata, getComputeServiceExample } from '../utils' +const metadataAsset = getMetadata() +const metadataAlgorithm = getMetadata(0, 'algorithm') +const computeServiceExample = getComputeServiceExample() + describe('Compute', () => { let ocean: Ocean let account: Account - let ddoAsset: DDO - let ddoAlgorithm: DDO let agreementId: string - - const metadataAsset = getMetadata() - const metadataAlgorithm = getMetadata(0, 'algorithm') - const computeServiceExample = getComputeServiceExample() + let dataset: DDO + let algorithm: DDO before(async () => { ocean = await Ocean.getInstance(config) @@ -24,25 +24,27 @@ describe('Compute', () => { await account.authenticate() }) - it('should publish a dataset and an algorithm', async () => { + it('should publish a dataset with a compute service object', async () => { const stepsAsset = [] - ddoAsset = await ocean.assets + dataset = await ocean.assets .create(metadataAsset as MetaData, account, [computeServiceExample]) .next(step => stepsAsset.push(step)) - assert.instanceOf(ddoAsset, DDO) + assert.instanceOf(dataset, DDO) assert.deepEqual(stepsAsset, [0, 1, 2, 3, 4, 5, 6, 7]) + }) + it('should publish an algorithm', async () => { const stepsAlgorithm = [] - ddoAlgorithm = await ocean.assets + algorithm = await ocean.assets .create(metadataAlgorithm as MetaData, account) .next(step => stepsAlgorithm.push(step)) - assert.instanceOf(ddoAlgorithm, DDO) + assert.instanceOf(algorithm, DDO) assert.deepEqual(stepsAlgorithm, [0, 1, 2, 3, 4, 5, 6, 7]) }) - it('should order the compute service', async () => { + it('should order the compute service of the dataset', async () => { const steps = [] try { await account.requestTokens( @@ -51,7 +53,7 @@ describe('Compute', () => { ) agreementId = await ocean.compute - .order(account, ddoAsset.id) + .order(account, dataset.id) .next(step => steps.push(step)) } catch {} @@ -60,7 +62,7 @@ describe('Compute', () => { }) it('should start a compute job', async () => { - const response = await ocean.compute.start(account, agreementId, ddoAlgorithm.id) + const response = await ocean.compute.start(account, agreementId, algorithm.id) assert.equal(response.status, ComputeJobStatus.Started) })