Skip to content

Commit

Permalink
add timeout to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SeqSEE committed Aug 14, 2024
1 parent 295c751 commit c24bd3d
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/MRXtoUSDOracle.spec.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
import { getPriceOracle } from "./index";
import { APIProvider } from "@metrixcoin/metrilib";
import { equal, notEqual } from "assert";
import {getPriceOracle} from './index';
import {APIProvider} from '@metrixcoin/metrilib';
import {equal, notEqual} from 'assert';

const provider = new APIProvider("MainNet");
const provider = new APIProvider('MainNet');

const oracle = getPriceOracle("MainNet", provider);
const oracle = getPriceOracle('MainNet', provider);

describe("MRXtoUSDOracle tests", () => {
it("Can get the value", async () => {
describe('MRXtoUSDOracle tests', () => {
it('Can get the value', async () => {
const value = await oracle.value();
notEqual(value, BigInt(0));
});
it("Can get the last update", async () => {
}).timeout(60000);
it('Can get the last update', async () => {
const update = await oracle.lastUpdate();
notEqual(update, BigInt(0));
});
it("Can get the recent history", async () => {
}).timeout(60000);
it('Can get the recent history', async () => {
const history = await oracle.recentPriceHistory();
notEqual(history.length, 0);
});
it("Can get a chunk of one from the history", async () => {
}).timeout(60000);
it('Can get a chunk of one from the history', async () => {
const history = await oracle.priceHistory(BigInt(0), BigInt(1));
equal(history.length, 1);
});
}).timeout(60000);

it("Can get a chunk of one from the history", async () => {
it('Can get a chunk of one from the history', async () => {
const index = await oracle.priceIndex();
let history: [value: bigint, blockNumber: bigint, timestamp: bigint][] = [];
if (index >= 7 * 24) {
Expand All @@ -38,7 +38,7 @@ describe("MRXtoUSDOracle tests", () => {
console.log(
JSON.stringify(
history,
(key, value) => (typeof value === "bigint" ? value.toString() : value) // return everything else unchanged
(key, value) => (typeof value === 'bigint' ? value.toString() : value) // return everything else unchanged
)
);
notEqual(history.length, 0);
Expand Down

0 comments on commit c24bd3d

Please sign in to comment.