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
730
Web3.js Development Pitfall
katsunoritanaka
1
850
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
Cloudflare AgentsとAI SDKでAIエージェントを作ってみた
briete
0
120
overlayPreferenceValue で実現する ピュア SwiftUI な AdMob ネイティブ広告
uhucream
0
140
明日から始めるリファクタリング
ryounasso
0
120
CSC509 Lecture 02
javiergs
PRO
0
410
Six and a half ridiculous things to do with Quarkus
hollycummins
0
100
iOSエンジニア向けの英語学習アプリを作る!
yukawashouhei
0
180
Building, Deploying, and Monitoring Ruby Web Applications with Falcon (Kaigi on Rails 2025)
ioquatix
1
330
Back to the Future: Let me tell you about the ACP protocol
terhechte
0
130
2分台で1500examples完走!爆速CIを支える環境構築術 - Kaigi on Rails 2025
falcon8823
3
3.4k
エンジニアとして高みを目指す、 利益を生み出す設計の考え方 / design-for-profit
minodriven
23
12k
止められない医療アプリ、そっと Swift 6 へ
medley
1
130
Catch Up: Go Style Guide Update
andpad
0
190
Featured
See All Featured
Optimising Largest Contentful Paint
csswizardry
37
3.4k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
252
21k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
2.6k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.5k
Context Engineering - Making Every Token Count
addyosmani
5
190
Bash Introduction
62gerente
615
210k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
51k
Testing 201, or: Great Expectations
jmmastey
45
7.7k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
285
14k
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
Facilitating Awesome Meetings
lara
56
6.6k
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