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

moved before into describe to enable running of single unit tests

This commit is contained in:
Sebastian Gerske 2018-10-19 12:27:46 +02:00
parent 61d4f9f64d
commit d777bd9030
7 changed files with 60 additions and 60 deletions

View File

@ -5,13 +5,13 @@ import ContractBaseMock from "../mocks/ContractBase.Mock"
const wrappedContract = new ContractBaseMock("OceanToken")
before(async () => {
ConfigProvider.configure(config)
await ContractHandler.deployContracts()
wrappedContract.initMock()
})
describe("ContractBase", () => {
describe("ContractWrapperBase", () => {
before(async () => {
ConfigProvider.configure(config)
await ContractHandler.deployContracts()
wrappedContract.initMock()
})
describe("#call()", () => {

View File

@ -3,13 +3,13 @@ import ConfigProvider from "../../src/ConfigProvider"
import ContractHandler from "../../src/keeper/ContractHandler"
import config from "../config"
before(async () => {
ConfigProvider.configure(config)
await ContractHandler.deployContracts()
})
describe("ContractHandler", () => {
before(async () => {
ConfigProvider.configure(config)
await ContractHandler.deployContracts()
})
describe("#get()", () => {
it("should load and get OceanToken correctly", async () => {

View File

@ -6,14 +6,14 @@ import config from "../config"
let keeper: Keeper
before(async () => {
ConfigProvider.configure(config)
await ContractHandler.deployContracts()
keeper = await Keeper.getInstance()
})
describe("Keeper", () => {
before(async () => {
ConfigProvider.configure(config)
await ContractHandler.deployContracts()
keeper = await Keeper.getInstance()
})
describe("public interface", () => {
it("should have market", () => {

View File

@ -9,16 +9,16 @@ import config from "../config"
let ocean: Ocean
let accounts: Account[]
before(async () => {
ConfigProvider.configure(config)
await ContractHandler.deployContracts()
ocean = await Ocean.getInstance(config)
accounts = await ocean.getAccounts()
})
describe("Account", () => {
before(async () => {
ConfigProvider.configure(config)
await ContractHandler.deployContracts()
ocean = await Ocean.getInstance(config)
accounts = await ocean.getAccounts()
})
describe("#getOceanBalance()", () => {
it("should get initial ocean balance", async () => {

View File

@ -19,21 +19,21 @@ let testAsset: Asset
let accounts: Account[]
let testPublisher: Account
before(async () => {
ConfigProvider.configure(config)
ProviderProvider.setProvider(ProviderMock)
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("Asset", () => {
before(async () => {
ConfigProvider.configure(config)
ProviderProvider.setProvider(ProviderMock)
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 () => {

View File

@ -17,18 +17,18 @@ const description = "This asset is pure owange"
const price = 100
const timeout = 100000000
before(async () => {
ConfigProvider.configure(config)
await ContractHandler.deployContracts()
ocean = await Ocean.getInstance(config)
accounts = await ocean.getAccounts()
testPublisher = accounts[0]
testAsset = new Asset(name, description, price, testPublisher)
})
describe("Ocean", () => {
before(async () => {
ConfigProvider.configure(config)
await ContractHandler.deployContracts()
ocean = await Ocean.getInstance(config)
accounts = await ocean.getAccounts()
testPublisher = accounts[0]
testAsset = new Asset(name, description, price, testPublisher)
})
describe("#getInstance()", () => {
it("should list accounts", async () => {

View File

@ -20,20 +20,20 @@ let accounts: Account[]
let testPublisher: Account
let testConsumer: Account
before(async () => {
ConfigProvider.configure(config)
await ContractHandler.deployContracts()
ocean = await Ocean.getInstance(config)
accounts = await ocean.getAccounts()
testPublisher = accounts[0]
testConsumer = accounts[1]
// register an asset to play around with
testAsset = new Asset(testName, testDescription, testPrice, testPublisher)
await ocean.register(testAsset)
})
describe("Order", () => {
before(async () => {
ConfigProvider.configure(config)
await ContractHandler.deployContracts()
ocean = await Ocean.getInstance(config)
accounts = await ocean.getAccounts()
testPublisher = accounts[0]
testConsumer = accounts[1]
// register an asset to play around with
testAsset = new Asset(testName, testDescription, testPrice, testPublisher)
await ocean.register(testAsset)
})
describe("#pay()", async () => {
it("should pay for an order", async () => {