-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from coinsambacom/fix/trubit-api
Fix: trubit
- Loading branch information
Showing
3 changed files
with
48 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { IExchange } from "../src/utils/DTOs"; | ||
|
||
import { testAllTickers, testBook, testTicker } from "./utils/helpers"; | ||
|
||
const CONNECTOR = "trubit", | ||
BASE = "BTC", | ||
QUOTE = "BRL"; | ||
|
||
describe.only(CONNECTOR, () => { | ||
let exchange: IExchange; | ||
|
||
beforeEach(async () => { | ||
const imported = await import(`../src/connectors/${CONNECTOR}`); | ||
|
||
const ExchangeClass = Object.values(imported)[0] as { new (): IExchange }; | ||
|
||
exchange = new ExchangeClass(); | ||
}); | ||
|
||
describe("getAllTickers", () => { | ||
it("should return an array of ITicker objects", async () => { | ||
const tickers = await exchange.getAllTickers!(); | ||
|
||
testAllTickers(tickers); | ||
}); | ||
}); | ||
|
||
describe("getTicker", () => { | ||
it("should return an ITicker object", async () => { | ||
const ticker = await exchange.getTicker!(BASE, QUOTE); | ||
|
||
testTicker(ticker); | ||
}); | ||
}); | ||
|
||
describe("getBook", () => { | ||
it("should return an IOrderbook object", async () => { | ||
const book = await exchange.getBook!(BASE, QUOTE); | ||
|
||
testBook(book); | ||
}); | ||
}); | ||
}); |