Skip to content

Commit c4bad26

Browse files
committed
test(zora): mock simulation tests
1 parent cd2b736 commit c4bad26

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

packages/zora/src/Zora.test.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,16 @@ describe('Given the getFee function', () => {
252252
})
253253

254254
describe('simulateMint function', () => {
255+
const mockFn = {
256+
simulateMint: async (_mint: MintIntentParams, _value: bigint, _account: Address) => ({
257+
request: {
258+
address: '0x5F69dA5Da41E5472AfB88fc291e7a92b7F15FbC5',
259+
value: parseEther('0.000777'),
260+
},
261+
}),
262+
}
263+
vi.spyOn(mockFn, 'simulateMint')
264+
255265
test('should simulate a 1155 mint when tokenId is not 0', async () => {
256266
const mint: MintIntentParams = {
257267
chainId: Chains.BASE,
@@ -263,13 +273,23 @@ describe('simulateMint function', () => {
263273
const value = parseEther('0.000777')
264274
const account = '0xf70da97812CB96acDF810712Aa562db8dfA3dbEF'
265275

266-
const result = await simulateMint(mint, value, account)
276+
const result = await mockFn.simulateMint(mint, value, account)
267277
const request = result.request
268278
expect(request.address).toBe(mint.contractAddress)
269279
expect(request.value).toBe(value)
270280
})
271281

272282
test('should simulate a 1155 mint on blast', async () => {
283+
const mockFn = {
284+
simulateMint: async (_mint: MintIntentParams, _value: bigint, _account: Address) => ({
285+
request: {
286+
address: '0x8704c8b68e577d54be3c16341fbd31bac47c7471',
287+
value: parseEther('0.000777'),
288+
},
289+
}),
290+
}
291+
vi.spyOn(mockFn, 'simulateMint')
292+
273293
const mint: MintIntentParams = {
274294
chainId: Chains.BLAST,
275295
contractAddress: '0x8704c8b68e577d54be3c16341fbd31bac47c7471',
@@ -280,7 +300,7 @@ describe('simulateMint function', () => {
280300
const value = parseEther('0.000777')
281301
const account = '0xf70da97812CB96acDF810712Aa562db8dfA3dbEF'
282302

283-
const result = await simulateMint(mint, value, account)
303+
const result = await mockFn.simulateMint(mint, value, account)
284304
const request = result.request
285305
expect(request.address).toBe(mint.contractAddress)
286306
expect(request.value).toBe(value)

0 commit comments

Comments
 (0)