Skip to content

Commit

Permalink
test(liquidity-sdk): rename mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Rubilmax committed Dec 9, 2024
1 parent 3153240 commit d85b427
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
26 changes: 13 additions & 13 deletions packages/liquidity-sdk-viem/README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
# @morpho-org/shared-liquidity-sdk-viem
# @morpho-org/liquidity-sdk-viem

<a href="https://www.npmjs.com/package/@morpho-org/shared-liquidity-sdk-viem">
<a href="https://www.npmjs.com/package/@morpho-org/liquidity-sdk-viem">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/npm/v/@morpho-org/shared-liquidity-sdk-viem?colorA=21262d&colorB=21262d&style=flat">
<img src="https://img.shields.io/npm/v/@morpho-org/shared-liquidity-sdk-viem?colorA=f6f8fa&colorB=f6f8fa&style=flat" alt="Version">
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/npm/v/@morpho-org/liquidity-sdk-viem?colorA=21262d&colorB=21262d&style=flat">
<img src="https://img.shields.io/npm/v/@morpho-org/liquidity-sdk-viem?colorA=f6f8fa&colorB=f6f8fa&style=flat" alt="Version">
</picture>
</a>
<a href="https://github.com/morpho-org/shared-liquidity-sdk-viem/blob/main/LICENSE">
<a href="https://github.com/morpho-org/liquidity-sdk-viem/blob/main/LICENSE">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/npm/l/@morpho-org/shared-liquidity-sdk-viem?colorA=21262d&colorB=21262d&style=flat">
<img src="https://img.shields.io/npm/l/@morpho-org/shared-liquidity-sdk-viem?colorA=f6f8fa&colorB=f6f8fa&style=flat" alt="MIT License">
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/npm/l/@morpho-org/liquidity-sdk-viem?colorA=21262d&colorB=21262d&style=flat">
<img src="https://img.shields.io/npm/l/@morpho-org/liquidity-sdk-viem?colorA=f6f8fa&colorB=f6f8fa&style=flat" alt="MIT License">
</picture>
</a>
<a href="https://www.npmjs.com/package/@morpho-org/shared-liquidity-sdk-viem">
<a href="https://www.npmjs.com/package/@morpho-org/liquidity-sdk-viem">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/npm/dm/@morpho-org/shared-liquidity-sdk-viem?colorA=21262d&colorB=21262d&style=flat">
<img src="https://img.shields.io/npm/dm/@morpho-org/shared-liquidity-sdk-viem?colorA=f6f8fa&colorB=f6f8fa&style=flat" alt="Downloads per month">
<source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/npm/dm/@morpho-org/liquidity-sdk-viem?colorA=21262d&colorB=21262d&style=flat">
<img src="https://img.shields.io/npm/dm/@morpho-org/liquidity-sdk-viem?colorA=f6f8fa&colorB=f6f8fa&style=flat" alt="Downloads per month">
</picture>
</a>
<br />
<br />

Viem-based package that provides utilities to build viem-based shared-liquidity bots on Morpho and examples using Flashbots and Morpho's GraphQL API.
Viem-based package that provides utilities to build viem-based liquidity bots on Morpho and examples using Flashbots and Morpho's GraphQL API.

## Installation

```bash
npm install @morpho-org/shared-liquidity-sdk-viem
npm install @morpho-org/liquidity-sdk-viem
```

```bash
yarn add @morpho-org/shared-liquidity-sdk-viem
yarn add @morpho-org/liquidity-sdk-viem
```

## Getting Started
Expand Down
10 changes: 5 additions & 5 deletions packages/liquidity-sdk-viem/test/dataloader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import { markets } from "@morpho-org/morpho-test";
import { BLUE_API_BASE_URL } from "@morpho-org/morpho-ts";
import { describe, expect } from "vitest";
import { LiquidityLoader } from "../src";
import sharedLiquidityMock0 from "./mocks/shared-liquidity.0.json";
import sharedLiquidityMock1 from "./mocks/shared-liquidity.1.json";
import apiMock0 from "./mocks/dataloader.0.json";
import apiMock1 from "./mocks/dataloader.1.json";
import { test } from "./setup.js";

const { usdc_wstEth, eth_wstEth, usdc_wbtc } = markets[ChainId.EthMainnet];

describe("dataloader", () => {
test("should fetch shared liquidity from api", async ({ client }) => {
nock(BLUE_API_BASE_URL).post("/graphql").reply(200, sharedLiquidityMock0);
nock(BLUE_API_BASE_URL).post("/graphql").reply(200, apiMock0);

const reallocations = await new LiquidityLoader(client).fetch(
usdc_wstEth.id,
Expand Down Expand Up @@ -41,7 +41,7 @@ describe("dataloader", () => {
test("should fetch shared liquidity for 1 market from api and 1 from rpc", async ({
client,
}) => {
nock(BLUE_API_BASE_URL).post("/graphql").reply(200, sharedLiquidityMock1);
nock(BLUE_API_BASE_URL).post("/graphql").reply(200, apiMock1);

const loader = new LiquidityLoader(client);

Expand Down Expand Up @@ -114,7 +114,7 @@ describe("dataloader", () => {
test("should fetch shared liquidity for 2 markets from rpc", async ({
client,
}) => {
nock(BLUE_API_BASE_URL).post("/graphql").reply(200, sharedLiquidityMock1);
nock(BLUE_API_BASE_URL).post("/graphql").reply(200, apiMock1);

const loader = new LiquidityLoader(client);

Expand Down

0 comments on commit d85b427

Please sign in to comment.