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

adapt unit tests

This commit is contained in:
Sebastian Gerske 2018-11-26 11:04:05 +01:00
parent 2201ebb997
commit 12bd56e5f9
2 changed files with 11 additions and 6 deletions

View File

@ -127,20 +127,24 @@ describe("Ocean", () => {
const publisher = accounts[0]
const consumer = accounts[1]
const ddo: DDO = await ocean.registerAsset(new MetaData(), publisher)
const metaData = new MetaData()
const ddo: DDO = await ocean.registerAsset(metaData, publisher)
const service: Service = ddo.findServiceByType("Access")
// @ts-ignore
WebServiceConnectorProvider.setConnector(new WebServiceConnectorMock(ddo))
const serviceAgreementSignature: any = await ocean.signServiceAgreement(ddo.id,
await consumer.requestTokens(metaData.base.price)
const signServiceAgreementResult: any = await ocean.signServiceAgreement(ddo.id,
service.serviceDefinitionId, consumer)
assert(serviceAgreementSignature)
assert(serviceAgreementSignature.serviceAgreementId)
assert(serviceAgreementSignature.serviceAgreementSignature)
assert(serviceAgreementSignature.serviceAgreementSignature.startsWith("0x"))
assert(signServiceAgreementResult)
assert(signServiceAgreementResult.serviceAgreementId, "no serviceAgreementId")
assert(signServiceAgreementResult.serviceAgreementSignature, "no serviceAgreementSignature")
assert(signServiceAgreementResult.serviceAgreementSignature.startsWith("0x"))
assert(signServiceAgreementResult.serviceAgreementSignature.length === 132)
})
})

View File

@ -71,6 +71,7 @@ describe("ServiceAgreement", () => {
assert(serviceAgreementSignature)
assert(serviceAgreementSignature.startsWith("0x"))
assert(serviceAgreementSignature.length === 132)
})
})