Hello guys. Does someone could help me on how to run a proper unit testing on solidity for my code? Thanks

Jun 5, 2021, 3:35 PM
Heyo, i recommend looking for a hardhat seed that comes with an example test for the greeter
i use this one
lol he is doxxed wtf
ima share the seed via pm, idk who the dude is but not gonna share it here lol
meh use this one
https://github.com/symfoni/hardhat-react-boilerplate
Jun 5, 2021, 4:15 PM
I'll check that thank you. Does it work with all solidity codes? Cause I need to run an automatization
Jun 5, 2021, 4:16 PM
it should
if you havent used hardhat you might have a bit of trouble setting it up but trust me it's worth it
you can deploy your own local node with hardhat and even use console.log on smart contracts
fuck truffle
Jun 5, 2021, 4:17 PM
I've never used it before
Don't worry I'll look it up first then come back with questions thanks
Jun 5, 2021, 4:17 PM
Why do you say so? Ahahah
Jun 5, 2021, 4:18 PM
Hahha migrated to hardhat and once you switch it's way more agile, didn't spend much time in truffle though
And the console.log on the contracts is a game changer for me
you run a local node with same defuault private keys always with just doing npx hardhut run
Jun 5, 2021, 4:20 PM
I can do the same with ganache
And by this what do you mean?
Jun 5, 2021, 4:20 PM
You can print values on functions literally
like
for example say you are testing transfers
you can add console.log(amount)
and it says in the console the amount being transfered
Really useful for debugging
Jun 5, 2021, 4:21 PM
🤔🤔will further investigate on this
Jun 5, 2021, 4:22 PM
Ya, i've got a friend at yearn and they switched to hh too and he's told me it's kinda replacing truffle but take me with a grain of salt ofc
Jun 5, 2021, 4:22 PM
But like on truffle too I can console.log the values emitted by events and stuff
Jun 5, 2021, 4:22 PM
the best tool sometimes is the one you like 🅿️
Yeah that's what you avoid basically, creating events for understanding, just console.log and that's it
Im sure it has more pros tho
But im just getting started on development kinda so again, take me with a grain of salt c:
Jun 5, 2021, 4:23 PM
Sure I'll do my own research but thanks for the input :)
Jun 5, 2021, 4:24 PM
https://hardhat.org/
Jun 5, 2021, 4:24 PM

© 2024 Draquery.com All rights reserved.