Skip to content

Commit

Permalink
Update with working solution of mocking metamaks
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinludu committed Oct 24, 2024
1 parent 495c28c commit 3254927
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .env.test.local.example
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ CREDENTIAL_WALLET_KEY=d093b8a44723eac658b4888743f945ff2066f1caba8c460f565002f998
# Make playwright show color output when CI=true - https://github.com/microsoft/playwright/issues/28260
FORCE_COLOR=1

REACT_APP_BUILDER_NFT_CONTRACT_ADDRESS=0x1d305a06cb9dbdc32e08c3d230889acb9fe8a4dd
REACT_APP_BUILDER_NFT_CONTRACT_ADDRESS=0x2cba9c6e0c14da826b0ec689cabf02a6f6b9808e
# so that we can load the UI and tests still pass
REACT_APP_WALLETCONNECT_PROJECTID=PLACEHOLDER_WALLETCONNECT_PROJECTID
5 changes: 3 additions & 2 deletions apps/scoutgame/__e2e__/buyNft.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { prisma } from '@charmverse/core/prisma-client';
import { installMockWallet } from '@johanneskares/wallet-mock';
import { getBuilderContractAddress } from '@packages/scoutgame/builderNfts/constants';
import { mockBuilder, mockBuilderNft } from '@packages/scoutgame/testing/database';
import { delay } from '@root/lib/utils/async';
import { custom, http } from 'viem';
Expand Down Expand Up @@ -28,7 +29,7 @@ test.describe('Buy Nft', () => {
return 500000;
}

if (method === 'eth_sendTransaction') {
if (method === 'eth_sendRawTransaction') {
return '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef';
}

Expand Down Expand Up @@ -73,7 +74,7 @@ test.describe('Buy Nft', () => {
builderId: builder.id,
chainId: 10,
// This is the op mainnet real contract
contractAddress: '0x743ec903fe6d05e73b19a6db807271bb66100e83',
contractAddress: getBuilderContractAddress(),
tokenId: 1
});

Expand Down
4 changes: 2 additions & 2 deletions packages/scoutgame/src/testing/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { BuilderEvent, BuilderEventType, GithubRepo, Scout } from '@charmve
import { prisma } from '@charmverse/core/prisma-client';
import { v4 as uuid } from 'uuid';

import { getCurrentWeek } from '../dates';
import { currentSeason, getCurrentWeek } from '../dates';

import { randomLargeInt, mockSeason } from './generators';

Expand Down Expand Up @@ -266,7 +266,7 @@ export async function mockBuilderNft({
tokenId = Math.round(Math.random() * 10000000),
contractAddress = '0x1',
owners = [],
season = mockSeason
season = currentSeason
}: {
builderId: string;
chainId?: number;
Expand Down

0 comments on commit 3254927

Please sign in to comment.