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

45 lines
1.6 KiB
TypeScript
Raw Normal View History

2018-10-29 17:28:40 +01:00
import {assert} from "chai"
import ConfigProvider from "../../src/ConfigProvider"
import { DDO } from "../../src/ddo/DDO"
2018-10-29 17:28:40 +01:00
import Account from "../../src/ocean/Account"
2018-12-17 15:54:58 +01:00
import DID from "../../src/ocean/DID"
2018-10-29 17:28:40 +01:00
import Ocean from "../../src/ocean/Ocean"
2018-11-05 14:56:14 +01:00
import ServiceAgreement from "../../src/ocean/ServiceAgreements/ServiceAgreement"
2019-02-21 18:14:07 +01:00
import { generateId } from "../../src/utils/GeneratorHelpers"
2018-10-30 08:30:05 +01:00
import config from "../config"
import TestContractHandler from "../keeper/TestContractHandler"
2018-10-29 17:28:40 +01:00
2018-12-17 15:54:58 +01:00
const did: DID = DID.generate()
2018-11-20 10:43:11 +01:00
2018-10-29 17:28:40 +01:00
describe("ServiceAgreement", () => {
2019-03-07 15:52:40 +01:00
let ocean: Ocean
2018-10-29 17:28:40 +01:00
2019-03-07 15:52:40 +01:00
let publisherAccount: Account
let consumerAccount: Account
2018-10-29 17:28:40 +01:00
before(async () => {
ConfigProvider.setConfig(config)
await TestContractHandler.prepareContracts()
2018-10-29 17:28:40 +01:00
ocean = await Ocean.getInstance(config)
2019-03-07 15:52:40 +01:00
const accounts = await ocean.getAccounts()
2018-10-29 17:28:40 +01:00
publisherAccount = accounts[1]
consumerAccount = accounts[2]
2018-10-29 17:28:40 +01:00
})
2018-11-07 08:43:04 +01:00
describe("#signServiceAgreement()", () => {
2019-03-07 15:52:40 +01:00
xit("should sign an service agreement", async () => {
// const ddo = new DDO({id: did.getDid(), service: [accessService]})
// const serviceAgreementId: string = generateId()
2018-11-22 10:56:06 +01:00
2019-03-07 15:52:40 +01:00
// const serviceAgreementSignature: string = await ServiceAgreement.signServiceAgreement(ddo, accessService.serviceDefinitionId,
// serviceAgreementId, consumerAccount)
2018-11-22 10:56:06 +01:00
2019-03-07 15:52:40 +01:00
// assert(serviceAgreementSignature)
// assert(serviceAgreementSignature.startsWith("0x"))
// assert(serviceAgreementSignature.length === 132)
2018-11-22 10:56:06 +01:00
})
2018-10-29 17:28:40 +01:00
})
})