Skip to content

Commit

Permalink
test: update flash mint wrapped tests to use chainId and swap quote p…
Browse files Browse the repository at this point in the history
…rovider
  • Loading branch information
janndriessen committed Sep 20, 2024
1 parent 8eab9ae commit a0ca679
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/quote/flashmint/wrapped/provider.test.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
import { LocalhostProviderUrl, QuoteTokens } from 'tests/utils'
import {
IndexZeroExSwapQuoteProvider,
LocalhostProviderUrl,
QuoteTokens,
} from 'tests/utils'
import { wei } from 'utils/numbers'
import { FlashMintWrappedQuoteRequest, WrappedQuoteProvider } from '.'

const { usdc, usdcy, weth } = QuoteTokens
const indexToken = usdcy
const chainId = 1
const provider = LocalhostProviderUrl
const swapQuoteProvider = IndexZeroExSwapQuoteProvider

describe('WrappedQuoteProvider()', () => {
test.only('returns a quote for minting USDCY', async () => {
const inputToken = usdc
const request: FlashMintWrappedQuoteRequest = {
chainId,
isMinting: true,
inputToken,
outputToken: indexToken,
indexTokenAmount: wei(1),
slippage: 0.5,
}
const quoteProvider = new WrappedQuoteProvider(provider)
const quoteProvider = new WrappedQuoteProvider(provider, swapQuoteProvider)
const quote = await quoteProvider.getQuote(request)
if (!quote) fail()
expect(quote.indexTokenAmount).toEqual(request.indexTokenAmount)
Expand All @@ -29,13 +36,14 @@ describe('WrappedQuoteProvider()', () => {
test('returns a quote for minting MMI w/ USDC', async () => {
const inputToken = usdc
const request: FlashMintWrappedQuoteRequest = {
chainId,
isMinting: true,
inputToken,
outputToken: indexToken,
indexTokenAmount: wei(1),
slippage: 0.5,
}
const quoteProvider = new WrappedQuoteProvider(provider)
const quoteProvider = new WrappedQuoteProvider(provider, swapQuoteProvider)
const quote = await quoteProvider.getQuote(request)
if (!quote) fail()
expect(quote.indexTokenAmount).toEqual(request.indexTokenAmount)
Expand All @@ -46,13 +54,14 @@ describe('WrappedQuoteProvider()', () => {
test('returns a quote for minting MMI w/ WETH', async () => {
const inputToken = weth
const request: FlashMintWrappedQuoteRequest = {
chainId,
isMinting: true,
inputToken,
outputToken: indexToken,
indexTokenAmount: wei(1),
slippage: 0.5,
}
const quoteProvider = new WrappedQuoteProvider(provider)
const quoteProvider = new WrappedQuoteProvider(provider, swapQuoteProvider)
const quote = await quoteProvider.getQuote(request)
if (!quote) fail()
expect(quote.indexTokenAmount).toEqual(request.indexTokenAmount)
Expand All @@ -63,13 +72,14 @@ describe('WrappedQuoteProvider()', () => {
test.only('returns a quote redeeming USDCY for USDC', async () => {
const outputToken = usdc
const request: FlashMintWrappedQuoteRequest = {
chainId,
isMinting: false,
inputToken: indexToken,
outputToken,
indexTokenAmount: wei(1),
slippage: 0.5,
}
const quoteProvider = new WrappedQuoteProvider(provider)
const quoteProvider = new WrappedQuoteProvider(provider, swapQuoteProvider)
const quote = await quoteProvider.getQuote(request)
if (!quote) fail()
expect(quote.indexTokenAmount).toEqual(request.indexTokenAmount)
Expand All @@ -82,13 +92,14 @@ describe('WrappedQuoteProvider()', () => {
test('returns a quote for redeeming MMI for WETH', async () => {
const outputToken = weth
const request: FlashMintWrappedQuoteRequest = {
chainId,
isMinting: false,
inputToken: indexToken,
outputToken,
indexTokenAmount: wei(1),
slippage: 0.5,
}
const quoteProvider = new WrappedQuoteProvider(provider)
const quoteProvider = new WrappedQuoteProvider(provider, swapQuoteProvider)
const quote = await quoteProvider.getQuote(request)
if (!quote) fail()
expect(quote.indexTokenAmount).toEqual(request.indexTokenAmount)
Expand Down

0 comments on commit a0ca679

Please sign in to comment.