Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Truffle における JS での テスト について
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Katsunori Tanaka
March 23, 2018
Programming
520
0
Share
Truffle における JS での テスト について
2018/03/22(木) 第2回ブロックチェーン勉強会@東京でLTした資料です。TruffleにおけるJSでのテストについて簡単にまとめています。
Katsunori Tanaka
March 23, 2018
More Decks by Katsunori Tanaka
See All by Katsunori Tanaka
DApp Questのコントラクト開発
katsunoritanaka
1
1.1k
SolidityとWeb3.jsについて
katsunoritanaka
1
740
Web3.js Development Pitfall
katsunoritanaka
1
880
Selectors Level4
katsunoritanaka
0
56
CSS Architecture with OOCSS, SMACSS, BEM
katsunoritanaka
6
400
LESS : The dynamic stylesheet language
katsunoritanaka
0
97
Other Decks in Programming
See All in Programming
Making the RBS Parser Faster
soutaro
0
660
Road to RubyKaigi: Play Hard(ware)
makicamel
1
550
エラー処理の温故知新 / history of error handling technic
ryotanakaya
7
1.8k
Surviving Black Friday: 329 billion requests with Falcon!
ioquatix
0
2.8k
GoogleCloudとterraform完全に理解した
terisuke
1
190
ローカルLLMでどこまでコードが書けるか / How much code can be written on a local LLM
kishida
2
310
空間オーディオの活用
objectiveaudio
0
130
Symfony AI in Action - SymfonyLive Berlin 2026
chr_hertel
1
120
書籍「ユーザーストーリーマッピング」が私のバイブル
asumikam
4
480
ハーネスエンジニアリングにどう向き合うか 〜ルールファイルを超えて開発プロセスを設計する〜 / How to approach harness engineering
rkaga
28
19k
AI-DLC Deep Dive
yuukiyo
9
5.6k
Programming with a DJ Controller — not vibe coding
m_seki
3
780
Featured
See All Featured
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Done Done
chrislema
186
16k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.9k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
23k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
110
Building Adaptive Systems
keathley
44
3k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
380
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.7k
Marketing to machines
jonoalderson
1
5.2k
4 Signs Your Business is Dying
shpigford
187
22k
Context Engineering - Making Every Token Count
addyosmani
9
860
Transcript
%..DPN-BCPాதࠀయ ୈճϒϩοΫνΣʔϯษڧձ!౦ژ 5SV⒐Fʹ͓͚Δ +4Ͱͷςετʹ͍ͭͯ
X © DMM.com Group ాதࠀయ ࣗݾհ ࣮࣭ ʹ+0*/ͨͯ͠ લॴଐɿϑϩϯτΤϯυ։ൃ෦
Լษڧத %..DPN-BCP εϚʔτίϯτϥΫτ։ൃ෦
X © DMM.com Group 5SV⒐FೖΕͯΈ·͢ IUUQUSV⒐FGSBNFXPSLDPN
X © DMM.com Group $ npm install -g truffle
X © DMM.com Group αϯϓϧͱͯ͠ 0⒏DJBM#PYFTͷ NFUBDPJOΛೖΕͯΈ·͢
X © DMM.com Group $ truffle unbox metacoin
X © DMM.com Group KTͷςετίʔυ UFTUNFUBDPJOKT ΛோΊͯΈ·͢
X © DMM.com Group it("should put 10000 MetaCoin in the
first account", function() { return MetaCoin.deployed().then(function(instance) { return instance.getBalance.call(accounts[0]); }).then(function(balance) { assert.equal(balance.valueOf(), 10000, "10000 wasn't in the first account"); }); }); UFTUNFUBDPJOKT
X © DMM.com Group function getBalance(address addr) public view returns(uint)
{ return balances[addr]; } .FUB$PJOTPM
X © DMM.com Group HFU#BMBODFϝιουͷ ΓͷܕVJOU ͬͯͪΖΜ+4ʹແ͍ʜ
X © DMM.com Group KTςετίʔυͰ DPOTPMFMPHଧͬͯ ࣮ࡍʹ֬ೝͯ͠Έ·͢
X © DMM.com Group function (balance) { console.log('-----------------------------------'); console.log('▼ getBalanceϝιουͷΓɿunitܕ
▼'); console.log(balance); console.log('-----------------------------------'); console.log('▼ JSͰͷܕ ▼'); console.log(typeof balance); console.log('-----------------------------------'); console.log('▼ valueOf() ͰJSϓϦϛςΟϒܕΛ֬ೝ ▼'); console.log(typeof balance.valueOf()); assert.equal(balance.valueOf(), 10000, "10000 wasn't in the first account”); }); UFTUNFUBDPJOKT
X © DMM.com Group ϙΠϯτ
X © DMM.com Group VJOUܕ͕KTςετίʔυͰɺ#JH/VNCFS0CKFDU #JH/VNCFSͷϓϦϛςΟϒܕ͕TUSJOH ͦͦςετίʔυͰɺܕνΣοΫΛ͍ͯ͠ͳ͍ ɹʢBTTFSUTUSJDU&RVBMͷํ͕ྑ͍ؾ͕͢Δʣ TPMJEJUZͰςετίʔυॻ͍ͨํ͕ྑ͍ͷ͔ͳʜʁ ɹʢ·ͩษڧෆɺ'&ΤϯδχΞʹͱ͖͍ͬͭ͢ʣ
X © DMM.com Group ࠷ޙʹ
X © DMM.com Group ·ͩ·ͩ தʂ ͬͱษڧ͠·͢ʂ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ 5IBOLZPVGPSZPVSLJOEBUUFOUJPO