mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
ee1dd8e30b
# Conflicts: # src/models/Config.ts # src/ocean/Ocean.ts # test/config.ts # test/keeper/ContractBase.test.ts # test/keeper/ContractHandler.test.ts # test/keeper/Keeper.test.ts # test/ocean/Account.test.ts # test/ocean/Asset.test.ts # test/ocean/Ocean.test.ts # test/ocean/Order.test.ts
47 lines
1.4 KiB
TypeScript
47 lines
1.4 KiB
TypeScript
import {assert} from "chai"
|
|
import AquariusProvider from "../../src/aquarius/AquariusProvider"
|
|
import ConfigProvider from "../../src/ConfigProvider"
|
|
import ContractHandler from "../../src/keeper/ContractHandler"
|
|
import Account from "../../src/ocean/Account"
|
|
import Asset from "../../src/ocean/Asset"
|
|
import Ocean from "../../src/ocean/Ocean"
|
|
import Order from "../../src/ocean/Order"
|
|
import config from "../config"
|
|
import AquariusMock from "../mocks/Aquarius.mock"
|
|
|
|
const testName = "Test Asset 2"
|
|
const testDescription = "This asset is pure owange"
|
|
const testPrice = 100
|
|
const timeout = 100000
|
|
|
|
let ocean: Ocean
|
|
let testAsset: Asset
|
|
let accounts: Account[]
|
|
let testPublisher: Account
|
|
|
|
describe("Asset", () => {
|
|
|
|
before(async () => {
|
|
ConfigProvider.setConfig(config)
|
|
AquariusProvider.setAquarius(new AquariusMock(config))
|
|
|
|
await ContractHandler.deployContracts()
|
|
ocean = await Ocean.getInstance(config)
|
|
accounts = await ocean.getAccounts()
|
|
testPublisher = accounts[0]
|
|
testAsset = new Asset(testName, testDescription, testPrice, testPublisher)
|
|
|
|
await ocean.register(testAsset)
|
|
})
|
|
|
|
describe("#purchase()", () => {
|
|
|
|
it("should purchase an asset", async () => {
|
|
|
|
// todo
|
|
const consumerAccount = accounts[5]
|
|
const order: Order = await testAsset.purchase(consumerAccount, timeout)
|
|
assert(order)
|
|
})
|
|
})
|