Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: move/organize js tests #364

Merged
merged 2 commits into from
Nov 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ jobs:
- name: Run trading tests
run: |
cd ./examples/js/
npx ts-node trade.ts
npx ts-node tests/trade.ts
sleep 5
npx ts-node print_orders.ts
npx ts-node tests/print_orders.ts
npx ts-node tests/transfer.ts
npx ts-node tests/put_batch_orders.ts
1 change: 1 addition & 0 deletions examples/js/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16.12.0
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import axios from "axios";
import { strict as assert } from "assert";
import "./config";
import "../config";

const isCI = !!process.env.GITHUB_ACTIONS;

Expand Down
8 changes: 4 additions & 4 deletions examples/js/stress.ts → examples/js/tests/stress.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { market, userId } from "./config"; // dotenv
import { defaultClient as client } from "./client";
import { market, userId } from "../config"; // dotenv
import { defaultClient as client } from "../client";

import { sleep, decimalAdd, assertDecimalEqual } from "./util";
import { sleep, decimalAdd, assertDecimalEqual } from "../util";

import { depositAssets, printBalance, putRandOrder } from "./exchange_helper";
import { depositAssets, printBalance, putRandOrder } from "../exchange_helper";

async function stressTest({ parallel, interval, repeat }) {
const tradeCountBefore = (await client.marketSummary(market)).trade_count;
Expand Down
10 changes: 5 additions & 5 deletions examples/js/tick.ts → examples/js/tests/tick.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ORDER_SIDE_BID, ORDER_SIDE_ASK } from "./config";
import { defaultClient as client } from "./client";
import { sleep, getRandomFloatAround, getRandomFloatAroundNormal, getRandomElem } from "./util";
import { ORDER_SIDE_BID, ORDER_SIDE_ASK } from "../config";
import { defaultClient as client } from "../client";
import { sleep, getRandomFloatAround, getRandomFloatAroundNormal, getRandomElem } from "../util";
import { Account } from "fluidex.js";
import { getTestAccount } from "./accounts";
import { getTestAccount } from "../accounts";
import { strict as assert } from "assert";
import { depositAssets, getPriceOfCoin, putLimitOrder } from "./exchange_helper";
import { depositAssets, getPriceOfCoin, putLimitOrder } from "../exchange_helper";

const verbose = true;
const botsIds = [1, 2, 3, 4, 5];
Expand Down
12 changes: 6 additions & 6 deletions examples/js/trade.ts → examples/js/tests/trade.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { userId, base, quote, market, fee, ORDER_SIDE_BID, ORDER_SIDE_ASK, ORDER_TYPE_MARKET, ORDER_TYPE_LIMIT } from "./config"; // dotenv
import { getTestAccount } from "./accounts";
import { defaultClient as client } from "./client";
import { sleep, assertDecimalEqual } from "./util";
import { depositAssets } from "./exchange_helper";
import { KafkaConsumer } from "./kafka_client";
import { userId, base, quote, market, fee, ORDER_SIDE_BID, ORDER_SIDE_ASK, ORDER_TYPE_MARKET, ORDER_TYPE_LIMIT } from "../config"; // dotenv
import { getTestAccount } from "../accounts";
import { defaultClient as client } from "../client";
import { sleep, assertDecimalEqual } from "../util";
import { depositAssets } from "../exchange_helper";
import { KafkaConsumer } from "../kafka_client";

import { Account } from "fluidex.js";
import Decimal from "decimal.js";
Expand Down