Skip to content

Commit

Permalink
fix: tests (#1018)
Browse files Browse the repository at this point in the history
* fix: tests

Signed-off-by: m-francia <[email protected]>

* deleted unused snap

Signed-off-by: m-francia <[email protected]>

* fixed contract tests

Signed-off-by: m-francia <[email protected]>

---------

Signed-off-by: m-francia <[email protected]>
  • Loading branch information
M-Francia authored Jan 19, 2024
1 parent b74f15b commit 3859315
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 62 deletions.
2 changes: 1 addition & 1 deletion contracts/scripts/contractsLifeCycle/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export async function deployContract(
): Promise<ContractId> {
const transaction = new ContractCreateFlow()
.setBytecode(factory.bytecode)
.setGas(250_000)
.setGas(500_000)
//.setAdminKey(Key)
if (contractMemo) {
transaction.setContractMemo(contractMemo)
Expand Down
2 changes: 1 addition & 1 deletion contracts/scripts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export async function deployContractSDK(
): Promise<ContractId> {
const transaction = new ContractCreateFlow()
.setBytecode(factory.bytecode)
.setGas(250_000)
.setGas(500_000)
//.setAdminKey(Key)
if (contractMemo) {
transaction.setContractMemo(contractMemo)
Expand Down
4 changes: 2 additions & 2 deletions hashconnect/lib/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sdk/src/core/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const QUERY_HANDLER_METADATA = '__queryHandler__';
export const TOKEN_CREATION_COST_HBAR = 80;
export const EVM_ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
export const HBAR_DECIMALS = 8;
export const CREATE_SC_GAS = 2500000;
export const CREATE_SC_GAS = 500000;
export const CASHIN_GAS = 120000;
export const BURN_GAS = 70000;
export const WIPE_GAS = 70000;
Expand Down
10 changes: 5 additions & 5 deletions web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions web/src/components/ModalWalletConnect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import WARNING_ICON from '../assets/svg/warning.svg';
import ERROR_ICON from '../assets/svg/error.svg';
import { SelectController } from './Form/SelectController';
import { useForm } from 'react-hook-form';
import { IMirrorRPCNode } from '../interfaces/IMirrorRPCNode';
import type { IMirrorRPCNode } from '../interfaces/IMirrorRPCNode';

const ModalWalletConnect = () => {
const { t } = useTranslation('global');
Expand Down Expand Up @@ -247,9 +247,9 @@ const ModalWalletConnect = () => {
);
};

var userAgent = navigator.userAgent;
const userAgent = navigator.userAgent;

var isChrome = userAgent.indexOf('Chrome') !== -1;
const isChrome = userAgent.indexOf('Chrome') !== -1;

return (
<>
Expand Down Expand Up @@ -311,7 +311,7 @@ const ModalWalletConnect = () => {
)}
{availableWallets.includes(SupportedWallets.METAMASK) ? (
<VStack
data-testid='Metamask'
data-testid="Metamask"
{...styles.providerStyle}
shouldWrapChildren
onClick={handleConnectMetamaskWallet}
Expand Down
15 changes: 14 additions & 1 deletion web/src/components/__test__/ModalWalletConnect.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import configureMockStore from 'redux-mock-store';
import { SupportedWallets } from '@hashgraph/stablecoin-npm-sdk';
import userEvent from '@testing-library/user-event';
import SDKService from '../../services/SDKService';
import type {IMirrorRPCNode} from "../../interfaces/IMirrorRPCNode";

const mockStore = configureMockStore();

Expand All @@ -24,16 +25,28 @@ describe(`<${ModalWalletConnect.name} />`, () => {
});

test('should has wallets and is clicked', async () => {
const rpcNode:IMirrorRPCNode = {
name: '::name::',
BASE_URL: '::url::',
API_KEY: '::key::',
Environment: '::env::',
isInConfig: true,
HEADER: '::header::'
}

const store = mockStore({
wallet: {
foundWallets: [SupportedWallets.HASHPACK, SupportedWallets.METAMASK],
selectedMirrors: rpcNode,
selectedRPCs: rpcNode
},
});
const component = render(<ModalWalletConnect />, store);

const metamask = component.getByTestId('Metamask');
await userEvent.click(metamask);

expect(SDKService.connectWallet).toHaveBeenCalledWith('Metamask', expect.any(String));
expect(SDKService.connectWallet).toHaveBeenCalledWith('Metamask', expect.any(String), undefined, undefined);
});

});

This file was deleted.

0 comments on commit 3859315

Please sign in to comment.