Skip to content

Commit

Permalink
fix: remove console logs
Browse files Browse the repository at this point in the history
no logging of tx hashes needed anymore, as all tests are stabile.
When debugging the developer can reintroduce the log themselves again
  • Loading branch information
janek26 committed Oct 29, 2021
1 parent de0f5cb commit 2269fae
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 43 deletions.
7 changes: 1 addition & 6 deletions __tests__/contracts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ describe('class Contract {}', () => {
} = await deployContract(compiledERC20, []);

contract = new Contract(compiledERC20.abi, erc20address);
// I want to show the tx number to the tester, so he/she can trace the transaction in the explorer.
// eslint-disable-next-line no-console
console.log('deployed erc20 contract', transaction_hash);

expect(code).toBe('TRANSACTION_RECEIVED');

await waitForTx(transaction_hash);
Expand All @@ -43,9 +41,6 @@ describe('class Contract {}', () => {
});
expect(response.code).toBe('TRANSACTION_RECEIVED');

// I want to show the tx number to the tester, so he/she can trace the transaction in the explorer.
// eslint-disable-next-line no-console
console.log('txId:', response.transaction_hash, ', funded wallet:', wallet);
await waitForTx(response.transaction_hash);
});
test('read balance after mint of that account', async () => {
Expand Down
12 changes: 0 additions & 12 deletions __tests__/starknet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ describe('starknet endpoints', () => {
).resolves.not.toThrow();
});
test('getTransaction()', async () => {
const x = await getTransaction(
'0x2086ff26645fb0e31a3e252302f3cb1e7612c60389102e5473dfc89758a3aa9'
);
console.log(x);
return expect(
getTransaction('0x2086ff26645fb0e31a3e252302f3cb1e7612c60389102e5473dfc89758a3aa9')
).resolves.not.toThrow();
Expand Down Expand Up @@ -108,10 +104,6 @@ describe('starknet endpoints', () => {
expect(response.code).toBe('TRANSACTION_RECEIVED');
expect(response.transaction_hash).toBeDefined();
expect(response.address).toBeDefined();

// I want to show the tx number to the tester, so he/she can trace the transaction in the explorer.
// eslint-disable-next-line no-console
console.log('txHash:', response.transaction_hash);
});

test('deployContract()', async () => {
Expand All @@ -129,10 +121,6 @@ describe('starknet endpoints', () => {
expect(response.code).toBe('TRANSACTION_RECEIVED');
expect(response.transaction_hash).toBeDefined();
expect(response.address).toBeDefined();

// I want to show the tx number to the tester, so he/she can trace the transaction in the explorer.
// eslint-disable-next-line no-console
console.log('txHash:', response.transaction_hash);
});
});
});
28 changes: 3 additions & 25 deletions __tests__/wallet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,33 +49,20 @@ const compiledErc20: CompiledContract = parse(
describe('deploy and test Wallet', () => {
const pk = randomAddress();

// eslint-disable-next-line no-console
console.log('PK:', pk);

const starkKeyPair = getKeyPair(pk);
const starkKeyPub = getStarkKey(starkKeyPair);
let wallet: Contract;
let walletAddress: string;
let erc20: Contract;
let erc20Address: string;
beforeAll(async () => {
const {
code: codeErc20,
transaction_hash: txErc20,
address: erc20AddressLocal,
} = await deployContract(compiledErc20, []);
const { code: codeErc20, address: erc20AddressLocal } = await deployContract(compiledErc20, []);
erc20Address = erc20AddressLocal;
erc20 = new Contract(compiledErc20.abi, erc20Address);
// I want to show the tx number to the tester, so he/she can trace the transaction in the explorer.
// eslint-disable-next-line no-console
console.log('deployed erc20', txErc20);

expect(codeErc20).toBe('TRANSACTION_RECEIVED');

const {
code,
transaction_hash,
address: walletAddressLocal,
} = await deployContract(
const { code, address: walletAddressLocal } = await deployContract(
compiledArgentAccount,
Contract.compileCalldata({
signer: starkKeyPub,
Expand All @@ -86,19 +73,13 @@ describe('deploy and test Wallet', () => {
);
walletAddress = walletAddressLocal;
wallet = new Contract(compiledArgentAccount.abi, walletAddress);
// I want to show the tx number to the tester, so he/she can trace the transaction in the explorer.
// eslint-disable-next-line no-console
console.log('deployed wallet', transaction_hash);
expect(code).toBe('TRANSACTION_RECEIVED');

const { code: codeErc20Mint, transaction_hash: txErc20Mint } = await erc20.invoke('mint', {
recipient: walletAddress,
amount: '1000',
});

// I want to show the tx number to the tester, so he/she can trace the transaction in the explorer.
// eslint-disable-next-line no-console
console.log('mint erc20', txErc20Mint);
expect(codeErc20Mint).toBe('TRANSACTION_RECEIVED');

await waitForTx(txErc20Mint);
Expand Down Expand Up @@ -139,9 +120,6 @@ describe('deploy and test Wallet', () => {
[toHex(r), toHex(s)]
);

// I want to show the tx number to the tester, so he/she can trace the transaction in the explorer.
// eslint-disable-next-line no-console
console.log('transfer erc20 using wallet execute', transaction_hash);
expect(code).toBe('TRANSACTION_RECEIVED');

await waitForTx(transaction_hash);
Expand Down

0 comments on commit 2269fae

Please sign in to comment.