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
Katsunori Tanaka
March 23, 2018
Programming
0
510
Truffle における JS での テスト について
2018/03/22(木) 第2回ブロックチェーン勉強会@東京でLTした資料です。TruffleにおけるJSでのテストについて簡単にまとめています。
Katsunori Tanaka
March 23, 2018
Tweet
Share
More Decks by Katsunori Tanaka
See All by Katsunori Tanaka
DApp Questのコントラクト開発
katsunoritanaka
1
1k
SolidityとWeb3.jsについて
katsunoritanaka
1
720
Web3.js Development Pitfall
katsunoritanaka
1
840
Selectors Level4
katsunoritanaka
0
52
CSS Architecture with OOCSS, SMACSS, BEM
katsunoritanaka
6
380
LESS : The dynamic stylesheet language
katsunoritanaka
0
87
Other Decks in Programming
See All in Programming
GUI操作LLMの最新動向: UI-TARSと関連論文紹介
kfujikawa
0
940
実践 Dev Containers × Claude Code
touyu
1
200
それ CLI フレームワークがなくてもできるよ / Building CLI Tools Without Frameworks
orgachem
PRO
17
3.9k
AIレビュアーをスケールさせるには / Scaling AI Reviewers
technuma
2
190
マイコンでもRustのtestがしたい その2/KernelVM Tokyo 18
tnishinaga
2
2.3k
20250808_AIAgent勉強会_ClaudeCodeデータ分析の実運用〜競馬を題材に回収率100%の先を目指すメソッドとは〜
kkakeru
0
170
Scale out your Claude Code ~自社専用Agentで10xする開発プロセス~
yukukotani
9
2.2k
兎に角、コードレビュー
mitohato14
0
110
UbieのAIパートナーを支えるコンテキストエンジニアリング実践
syucream
2
200
Introduction to Git & GitHub
latte72
0
110
DataformでPythonする / dataform-de-python
snhryt
0
170
Constant integer division faster than compiler-generated code
herumi
2
650
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
100
5.7k
Building an army of robots
kneath
306
45k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
8
460
A better future with KSS
kneath
239
17k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
How to train your dragon (web standard)
notwaldorf
96
6.2k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
Scaling GitHub
holman
462
140k
How to Ace a Technical Interview
jacobian
279
23k
Typedesign – Prime Four
hannesfritz
42
2.8k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.8k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
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