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