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

add unit test for compute.checkOutput()

This commit is contained in:
Matthias Kretschmann 2020-02-03 11:46:48 +01:00
parent fd8ad9d96b
commit 2096329341
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 24 additions and 1 deletions

View File

@ -93,7 +93,7 @@ export class OceanCompute extends Instantiable {
* @param {Output} output Output section used for publishing the result.
* @return {Promise<Output>} Returns output object
*/
private checkOutput(consumerAccount: Account, output?: Output): Output {
public checkOutput(consumerAccount: Account, output?: Output): Output {
const isDefault =
!output || (!output.publishAlgorithmLog && !output.publishOutput)

View File

@ -103,4 +103,27 @@ describe('OceanCompute', () => {
assert(response[0].status === ComputeJobStatus.Started)
})
})
describe('#checkOutput()', () => {
it('should return default values', async () => {
const defaultOutput = { publishAlgorithmLog: false, publishOutput: false }
const output = compute.checkOutput(account, undefined)
assert.deepEqual(output, defaultOutput)
})
it('should return output values', async () => {
const newOutput = {
publishAlgorithmLog: true,
publishOutput: true,
brizoAddress: 'hello',
brizoUri: 'hello',
metadataUri: 'hello',
nodeUri: 'hello',
owner: '0xhello',
secretStoreUri: 'hello'
}
const output = compute.checkOutput(account, newOutput)
assert.deepEqual(output, newOutput)
})
})
})