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
480
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
970
SolidityとWeb3.jsについて
katsunoritanaka
1
660
Web3.js Development Pitfall
katsunoritanaka
1
790
Selectors Level4
katsunoritanaka
0
49
CSS Architecture with OOCSS, SMACSS, BEM
katsunoritanaka
6
360
LESS : The dynamic stylesheet language
katsunoritanaka
0
84
Other Decks in Programming
See All in Programming
Jakarta EE meets AI
ivargrimstad
0
190
Flutterを言い訳にしない!アプリの使い心地改善テクニック5選🔥
kno3a87
1
210
Pinia Colada が実現するスマートな非同期処理
naokihaba
4
230
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
270
CSC509 Lecture 13
javiergs
PRO
0
110
みんなでプロポーザルを書いてみた
yuriko1211
0
280
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
1k
Modular Monolith Monorepo ~シンプルさを保ちながらmonorepoのメリットを最大化する~
yuisakamoto
5
330
ECS Service Connectのこれまでのアップデートと今後のRoadmapを見てみる
tkikuc
2
260
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.2k
Amazon Qを使ってIaCを触ろう!
maruto
0
420
カンファレンスの「アレ」Webでなんとかしませんか? / Conference “thing” Why don't you do something about it on the Web?
dero1to
1
110
Featured
See All Featured
The Cult of Friendly URLs
andyhume
78
6k
A Tale of Four Properties
chriscoyier
156
23k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
44
2.2k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
Practical Orchestrator
shlominoach
186
10k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
RailsConf 2023
tenderlove
29
900
YesSQL, Process and Tooling at Scale
rocio
169
14k
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
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