mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
Fix style issues and failing unit tests.
This commit is contained in:
parent
e2ed974af2
commit
c26ae88fa3
@ -24,9 +24,9 @@ before_script:
|
||||
- git clone https://github.com/oceanprotocol/barge
|
||||
- cd barge
|
||||
- export AQUARIUS_VERSION=v1.0.7
|
||||
- export BRIZO_VERSION=v0.9.0
|
||||
- export BRIZO_VERSION=v0.9.3
|
||||
- export KEEPER_VERSION=v0.13.2
|
||||
- export EVENTS_HANDLER_VERSION=v0.4.4
|
||||
- export EVENTS_HANDLER_VERSION=v0.4.5
|
||||
- export KEEPER_OWNER_ROLE_ADDRESS="0xe2DD09d719Da89e5a3D0F2549c7E24566e947260"
|
||||
- rm -rf "${HOME}/.ocean/keeper-contracts/artifacts"
|
||||
- bash -x start_ocean.sh --no-commons --no-dashboard 2>&1 > start_ocean.log &
|
||||
|
@ -137,10 +137,10 @@ export class Brizo extends Instantiable {
|
||||
url += `?signature=${signature}`
|
||||
url += `&consumerAddress=${address}`
|
||||
url += `&serviceAgreementId=${noZeroX(serviceAgreementId)}`
|
||||
url += algorithmDid && `&algorithmDid=${algorithmDid}` || ''
|
||||
url += algorithmMeta && `&algorithmMeta=${algorithmMeta}` || ''
|
||||
url += output && `&output=${JSON.stringify(output)}` || ''
|
||||
url += jobId && `&jobId=${jobId}` || ''
|
||||
url += (algorithmDid && `&algorithmDid=${algorithmDid}`) || ''
|
||||
url += (algorithmMeta && `&algorithmMeta=${algorithmMeta}`) || ''
|
||||
url += (output && `&output=${JSON.stringify(output)}`) || ''
|
||||
url += (jobId && `&jobId=${jobId}`) || ''
|
||||
|
||||
// switch fetch method
|
||||
let fetch
|
||||
|
@ -159,12 +159,16 @@ export class OceanAssets extends Instantiable {
|
||||
})
|
||||
|
||||
// Overwrite initial service agreement conditions
|
||||
let rawConditions = await templates.escrowAccessSecretStoreTemplate.getServiceAgreementTemplateConditions()
|
||||
serviceAgreementTemplate.conditions = fillConditionsWithDDO(rawConditions, ddo)
|
||||
for (let service of services) {
|
||||
serviceAgreementTemplate.conditions = fillConditionsWithDDO(
|
||||
await templates.escrowAccessSecretStoreTemplate.getServiceAgreementTemplateConditions(),
|
||||
ddo
|
||||
)
|
||||
for (const service of services) {
|
||||
if (service.type === 'compute') {
|
||||
const rawConditions = await templates.escrowComputeExecutionTemplate.getServiceAgreementTemplateConditions()
|
||||
service.attributes.serviceAgreementTemplate.conditions = fillConditionsWithDDO(rawConditions, ddo)
|
||||
service.attributes.serviceAgreementTemplate.conditions = fillConditionsWithDDO(
|
||||
await templates.escrowComputeExecutionTemplate.getServiceAgreementTemplateConditions(),
|
||||
ddo
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,6 @@ import { SubscribablePromise } from '../utils'
|
||||
import { OrderProgressStep } from './utils/ServiceUtils'
|
||||
import { DID } from '../squid'
|
||||
|
||||
|
||||
export const ComputeJobStatus = Object.freeze({
|
||||
Started: 10,
|
||||
ConfiguringVolumes: 20,
|
||||
@ -250,7 +249,7 @@ export class OceanCompute extends Instantiable {
|
||||
consumerAccount: Account,
|
||||
agreementId: string,
|
||||
jobId: string
|
||||
): Promise<ComputeJob> {
|
||||
): Promise<ComputeJob> {
|
||||
const computeJobsList = await this.ocean.brizo.compute(
|
||||
'get',
|
||||
agreementId,
|
||||
|
@ -86,7 +86,12 @@ describe('Asset Owners', () => {
|
||||
// Granting access
|
||||
try {
|
||||
await account2.requestTokens(
|
||||
parseInt((+metadata.main.price * 10 ** -(await ocean.keeper.token.decimals())).toString())
|
||||
parseInt(
|
||||
(
|
||||
+metadata.main.price *
|
||||
10 ** -(await ocean.keeper.token.decimals())
|
||||
).toString()
|
||||
)
|
||||
)
|
||||
} catch {}
|
||||
|
||||
|
@ -70,8 +70,12 @@ describe('Compute', () => {
|
||||
const steps = []
|
||||
try {
|
||||
await account.requestTokens(
|
||||
parseInt((+computeService.attributes.main.price *
|
||||
10 ** -(await ocean.keeper.token.decimals())).toString())
|
||||
parseInt(
|
||||
(
|
||||
+computeService.attributes.main.price *
|
||||
10 ** -(await ocean.keeper.token.decimals())
|
||||
).toString()
|
||||
)
|
||||
)
|
||||
|
||||
agreementId = await ocean.compute
|
||||
|
@ -45,8 +45,12 @@ describe('Consume Asset', () => {
|
||||
|
||||
it('should be able to request tokens for consumer', async () => {
|
||||
const initialBalance = (await consumer.getBalance()).ocn
|
||||
const claimedTokens =
|
||||
parseInt((+metadata.main.price * 10 ** -(await ocean.keeper.token.decimals())).toString())
|
||||
const claimedTokens = parseInt(
|
||||
(
|
||||
+metadata.main.price *
|
||||
10 ** -(await ocean.keeper.token.decimals())
|
||||
).toString()
|
||||
)
|
||||
|
||||
try {
|
||||
await consumer.requestTokens(claimedTokens)
|
||||
|
@ -54,7 +54,12 @@ describe('Consume Asset (Brizo)', () => {
|
||||
|
||||
try {
|
||||
await consumer.requestTokens(
|
||||
parseInt((+metadata.main.price * 10 ** -(await ocean.keeper.token.decimals())).toString())
|
||||
parseInt(
|
||||
(
|
||||
+metadata.main.price *
|
||||
10 ** -(await ocean.keeper.token.decimals())
|
||||
).toString()
|
||||
)
|
||||
)
|
||||
|
||||
agreementId = await ocean.assets
|
||||
|
@ -52,7 +52,12 @@ xdescribe('Consume Asset (Large size)', () => {
|
||||
it('should order the asset', async () => {
|
||||
try {
|
||||
await consumer.requestTokens(
|
||||
parseInt((+metadata.main.price * 10 ** -(await ocean.keeper.token.decimals())).toString())
|
||||
parseInt(
|
||||
(
|
||||
+metadata.main.price *
|
||||
10 ** -(await ocean.keeper.token.decimals())
|
||||
).toString()
|
||||
)
|
||||
)
|
||||
} catch {}
|
||||
|
||||
|
@ -27,7 +27,7 @@ describe('OceanCompute', () => {
|
||||
|
||||
describe('#start()', () => {
|
||||
it('should start a new job', async () => {
|
||||
sinon.stub(ocean.brizo, 'compute').returns({ jobId: 'my-job-id' } as any)
|
||||
sinon.stub(ocean.brizo, 'compute').returns([{ jobId: 'my-job-id' }] as any)
|
||||
const response = await compute.start(account, agreementId, 'did:op:0xxx')
|
||||
assert(response.jobId === 'my-job-id')
|
||||
})
|
||||
@ -37,7 +37,7 @@ describe('OceanCompute', () => {
|
||||
it('should stop a job', async () => {
|
||||
sinon
|
||||
.stub(ocean.brizo, 'compute')
|
||||
.returns({ status: ComputeJobStatus.Completed } as any)
|
||||
.returns([{ status: ComputeJobStatus.Completed }] as any)
|
||||
|
||||
const response = await compute.stop(account, agreementId, 'xxx')
|
||||
assert(response.status === ComputeJobStatus.Completed)
|
||||
@ -48,7 +48,7 @@ describe('OceanCompute', () => {
|
||||
it('should restart a job', async () => {
|
||||
sinon
|
||||
.stub(ocean.brizo, 'compute')
|
||||
.returns({ status: ComputeJobStatus.Started, jobId: 'my-job-id' } as any)
|
||||
.returns([{ status: ComputeJobStatus.Started, jobId: 'my-job-id' }] as any)
|
||||
|
||||
const response = await compute.restart(account, agreementId, 'xxx')
|
||||
assert(response.jobId === 'my-job-id')
|
||||
@ -59,7 +59,7 @@ describe('OceanCompute', () => {
|
||||
it('should delete a job', async () => {
|
||||
sinon
|
||||
.stub(ocean.brizo, 'compute')
|
||||
.returns({ status: ComputeJobStatus.Deleted } as any)
|
||||
.returns([{ status: ComputeJobStatus.Deleted }] as any)
|
||||
|
||||
const response = await compute.delete(account, agreementId, 'xxx')
|
||||
assert(response.status === ComputeJobStatus.Deleted)
|
||||
|
Loading…
Reference in New Issue
Block a user