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

Fix integration tests.

This commit is contained in:
Pedro Gutiérrez 2019-05-29 15:52:35 +02:00 committed by Pedro Gutiérrez
parent 6f57118ce9
commit 172967c352
7 changed files with 21 additions and 14 deletions

View File

@ -21,8 +21,8 @@ before_script:
- ganache-cli --port 18545 > ganache-cli.log &
- git clone https://github.com/oceanprotocol/barge
- cd barge
- export AQUARIUS_VERSION=v0.2.2
- export BRIZO_VERSION=v0.3.6
- export AQUARIUS_VERSION=v0.2.7
- export BRIZO_VERSION=v0.3.9
- export KEEPER_VERSION=v0.9.7
- export KEEPER_OWNER_ROLE_ADDRESS="0xe2DD09d719Da89e5a3D0F2549c7E24566e947260"
- bash -x start_ocean.sh --latest --no-pleuston --local-spree-node 2>&1 > start_ocean.log &

View File

@ -53,7 +53,7 @@ describe("Asset Owners", () => {
assert.equal(finalLength1 - initialLength, 0)
// Granting access
await account2.requestTokens(metadata.base.price)
await account2.requestTokens(+metadata.base.price * (10 ** -await ocean.keeper.token.decimals()))
await ocean.assets.order(ddo.id, ddo.findServiceByType("Access").serviceDefinitionId, account2)
// Access granted

View File

@ -34,7 +34,7 @@ describe("Consume Asset (Brizo)", () => {
it("should order the asset", async () => {
const accessService = ddo.findServiceByType("Access")
await consumer.requestTokens(metadata.base.price)
await consumer.requestTokens(+metadata.base.price * (10 ** -await ocean.keeper.token.decimals()))
const steps = []
agreementId = await ocean.assets.order(ddo.id, accessService.serviceDefinitionId, consumer)

View File

@ -13,13 +13,14 @@ const metadata: Partial<MetaData> = {
workExample: "423432fsd,51.509865,-0.118092,2011-01-01T10:55:11+00:00,7.2,68",
links: [
{
sample1: "http://data.ceda.ac.uk/badc/ukcp09/data/gridded-land-obs/gridded-land-obs-daily/",
name: "Sample of Asset Data",
type: "sample",
url: "https://foo.com/sample.csv",
},
{
sample2: "http://data.ceda.ac.uk/badc/ukcp09/data/gridded-land-obs/gridded-land-obs-averages-25km/",
},
{
fieldsDescription: "http://data.ceda.ac.uk/badc/ukcp09/",
name: "Data Format Definition",
type: "format",
url: "https://foo.com/sample.csv",
},
],
inLanguage: "en",

View File

@ -20,7 +20,7 @@ export class AccessSecretStoreCondition extends Condition {
return this.call<boolean>("checkPermissions", [grantee, didZeroX(did)].map(zeroX), from)
}
public async getGrantedDidByConsumer(consumer: string): Promise<{did: string, agreementId: string}[]> {
public async getGrantedDidByConsumer(consumer: string): Promise<Array<{did: string, agreementId: string}>> {
return (await this.getPastEvents("Fulfilled", {_grantee: zeroX(consumer)}))
.map(({returnValues}) => ({
did: didPrefixed(returnValues._documentId),

View File

@ -69,8 +69,14 @@ export class EscrowAccessSecretStoreTemplate extends AgreementTemplate {
* @param {string} from Consumer address.
* @return {Promise<string>} Agreement ID.
*/
public async createFullAgreement(did: string, amount: number | string, consumer: string, from?: string, agreementId?: string): Promise<string> {
agreementId = agreementId || generateId()
public async createFullAgreement(
did: string,
amount: number | string,
consumer: string,
from?: string,
agreementId: string = generateId(),
): Promise<string> {
const {accessSecretStoreConditionId, lockRewardConditionId, escrowRewardId} =
await this.createFullAgreementData(agreementId, did, amount, consumer)

View File

@ -6,7 +6,7 @@ function fillParameterWithDDO(parameter: ServiceAgreementTemplateParameter, ddo:
switch (name) {
case "amount":
case "price":
return ddo.findServiceByType("Metadata").metadata.base.price.toString()
return String(ddo.findServiceByType("Metadata").metadata.base.price)
case "assetId":
case "documentId":
case "documentKeyId":
@ -19,7 +19,7 @@ function fillParameterWithDDO(parameter: ServiceAgreementTemplateParameter, ddo:
}
const value = getValue(parameter.name.replace(/^_/, ""))
return {...parameter, value: parameter.type.includes("int") ? Number(value) : value}
return {...parameter, value}
}
/**