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
90
Other Decks in Programming
See All in Programming
今だからこそ入門する Server-Sent Events (SSE)
nearme_tech
PRO
3
170
AIコーディングAgentとの向き合い方
eycjur
0
270
速いWebフレームワークを作る
yusukebe
5
1.7k
Navigation 2 を 3 に移行する(予定)ためにやったこと
yokomii
0
160
Introducing ReActionView: A new ActionView-compatible ERB Engine @ Rails World 2025, Amsterdam
marcoroth
0
680
MCPでVibe Working。そして、結局はContext Eng(略)/ Working with Vibe on MCP And Context Eng
rkaga
5
2.3k
開発チーム・開発組織の設計改善スキルの向上
masuda220
PRO
20
11k
Navigating Dependency Injection with Metro
zacsweers
3
260
Laravel Boost 超入門
fire_arlo
3
210
ProxyによるWindow間RPC機構の構築
syumai
3
1.2k
Testing Trophyは叫ばない
toms74209200
0
860
プロポーザル駆動学習 / Proposal-Driven Learning
mackey0225
2
1.3k
Featured
See All Featured
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
252
21k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Fireside Chat
paigeccino
39
3.6k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.1k
Typedesign – Prime Four
hannesfritz
42
2.8k
Building Flexible Design Systems
yeseniaperezcruz
328
39k
Unsuck your backbone
ammeep
671
58k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.5k
Practical Orchestrator
shlominoach
190
11k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
112
20k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
33
2.4k
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