Skip to content

Commit

Permalink
fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
mariacarmina committed Feb 27, 2024
1 parent 1dbc24a commit 4754234
Showing 1 changed file with 53 additions and 52 deletions.
105 changes: 53 additions & 52 deletions src/test/integration/computeFees.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,59 +406,60 @@ describe('Compute provider fees', async () => {

resp.stream.on('end', () => {
console.log('Received data:', receivedData)
try {
const receivedDataParsed = JSON.parse(receivedData)
console.log('Parsed data:', receivedDataParsed)
assert(receivedDataParsed.algorithm, 'algorithm does not exist')
assert(
receivedDataParsed.algorithm.providerFeeAddress,
'algorithm providerFeeAddress does not exist'
)
assert(
receivedDataParsed.algorithm.providerFeeToken,
'algorithm providerFeeToken does not exist'
)
assert(
receivedDataParsed.algorithm.providerFeeAmount === 0,
'algorithm providerFeeToken does not exist'
) // it uses the free env
assert(
receivedDataParsed.algorithm.providerFeeData,
'algorithm providerFeeData does not exist'
)

assert(
receivedDataParsed.algorithm.validUntil ===
initializeComputeTask.compute.validUntil / 1000,
'algorithm providerFeeData does not exist'
)

assert(receivedDataParsed.datasets.length > 0, 'datasets key does not exist')
assert(
receivedDataParsed.datasets[0].providerFeeAddress,
'algorithm providerFeeAddress does not exist'
)
assert(
receivedDataParsed.datasets[0].providerFeeToken,
'algorithm providerFeeToken does not exist'
)
assert(
receivedDataParsed.datasets[0].providerFeeAmount === 0,
'algorithm providerFeeToken does not exist'
) // it uses the free env
assert(
receivedDataParsed.datasets[0].providerFeeData,
'algorithm providerFeeData does not exist'
)

assert(
receivedDataParsed.datasets[0].validUntil ===
initializeComputeTask.compute.validUntil / 1000,
'algorithm providerFeeData does not exist'
)
} catch (error) {
console.error('Error parsing JSON:', error)
}
})

resp.stream.on('error', (err) => {
console.error('Stream error:', err)
})
const receivedDataParsed = JSON.parse(receivedData)
assert(receivedDataParsed.algorithm, 'algorithm does not exist')
assert(
receivedDataParsed.algorithm.providerFeeAddress,
'algorithm providerFeeAddress does not exist'
)
assert(
receivedDataParsed.algorithm.providerFeeToken,
'algorithm providerFeeToken does not exist'
)
assert(
receivedDataParsed.algorithm.providerFeeAmount === 0,
'algorithm providerFeeToken does not exist'
) // it uses the free env
assert(
receivedDataParsed.algorithm.providerFeeData,
'algorithm providerFeeData does not exist'
)

assert(
receivedDataParsed.algorithm.validUntil ===
initializeComputeTask.compute.validUntil / 1000,
'algorithm providerFeeData does not exist'
)

assert(receivedDataParsed.datasets.length > 0, 'datasets key does not exist')
assert(
receivedDataParsed.datasets[0].providerFeeAddress,
'algorithm providerFeeAddress does not exist'
)
assert(
receivedDataParsed.datasets[0].providerFeeToken,
'algorithm providerFeeToken does not exist'
)
assert(
receivedDataParsed.datasets[0].providerFeeAmount === 0,
'algorithm providerFeeToken does not exist'
) // it uses the free env
assert(
receivedDataParsed.datasets[0].providerFeeData,
'algorithm providerFeeData does not exist'
)

assert(
receivedDataParsed.datasets[0].validUntil ===
initializeComputeTask.compute.validUntil / 1000,
'algorithm providerFeeData does not exist'
)
})

after(async () => {
Expand Down

0 comments on commit 4754234

Please sign in to comment.