Test-Driven Development with React and TypeScript: Building Maintainable React Applications 2nd Edition Juntao Qiu instant download
Test-Driven Development with React and TypeScript: Building Maintainable React Applications 2nd Edition Juntao Qiu instant download
https://ebookmass.com/product/test-driven-development-with-react-
and-typescript-building-maintainable-react-applications-2nd-
edition-juntao-qiu/
https://ebookmass.com/product/react-and-react-native-fifth-edition-
mikhail-sakhniuk/
https://ebookmass.com/product/%e7%8e%b0%e4%bb%a3%e5%85%a8%e6%a0%88%e5%
bc%80%e5%8f%91-%e4%bd%bf%e7%94%a8-
typescript%e3%80%81react%e3%80%81node-
js%e3%80%81webpack-%e5%92%8c-docker-frank-zammetti/
https://ebookmass.com/product/master-react-in-5-days-become-a-react-
expert-in-under-a-week-eric-sarrion/
https://ebookmass.com/product/master-react-in-5-days-become-a-react-
expert-in-under-a-week-eric-sarrion-2/
Test-Driven Development in Go Simion
https://ebookmass.com/product/test-driven-development-in-go-simion/
https://ebookmass.com/product/react-hooks-in-action-meap-03-john-
larsen-larsen/
https://ebookmass.com/product/hands-on-test-driven-development-using-
ruby-ruby-on-rails-and-rspec-1st-edition-greg-donald/
https://ebookmass.com/product/hands-on-test-driven-development-using-
ruby-ruby-on-rails-and-rspec-1-converted-edition-greg-donald/
Juntao Qiu
Test-Driven Development with React and TypeScript: Building
Maintainable React Applications
Juntao Qiu
Wantirna, 3152, VIC, Australia
v
Table of Contents
vi
Table of Contents
vii
Table of Contents
viii
Table of Contents
Unit Tests����������������������������������������������������������������������������������������������������������132
Refactoring��������������������������������������������������������������������������������������������������133
Book Detail Page�����������������������������������������������������������������������������������������137
File Structure�����������������������������������������������������������������������������������������������139
Testing Data������������������������������������������������������������������������������������������������������141
User Interface Refinement��������������������������������������������������������������������������������143
Using Grid System���������������������������������������������������������������������������������������144
Handling Default Value��������������������������������������������������������������������������������������146
A Failing Test with undefined����������������������������������������������������������������������146
One Last Change?���������������������������������������������������������������������������������������������149
Summary����������������������������������������������������������������������������������������������������������150
ix
Table of Contents
x
Visit https://ebookmass.com today to explore
a vast collection of ebooks across various
genres, available in popular formats like
PDF, EPUB, and MOBI, fully compatible with
all devices. Enjoy a seamless reading
experience and effortlessly download high-
quality materials in just a few simple steps.
Plus, don’t miss out on exciting offers that
let you access a wealth of knowledge at the
best prices!
Table of Contents
Index�������������������������������������������������������������������������������������������������259
xi
About the Author
Juntao Qiu is an accomplished software
developer renowned for his expertise
in producing high-quality and easily
maintainable code. He is committed to
helping individuals improve their code-
writing abilities and generously shares his vast
knowledge and experience through multiple
platforms, including books such as this one
and Maintainable React (Leanpub, 2022).
In addition, Juntao hosts a YouTube channel (@icodeit.juntao) where
he provides valuable insights, tips, and best practices for writing clean
code and performing refactoring. Juntao’s goal is to empower developers,
enabling them to reach their full potential and have a positive impact on
the software development industry.
xiii
About the Technical Reviewers
Jeff Friesen is a freelance teacher and
software developer with an emphasis on
Java. In addition to authoring Java I/O, NIO
and NIO.2 (Apress) and Java Threads and
the Concurrency Utilities (Apress), Jeff has
written numerous articles on Java and other
technologies (such as Android) for JavaWorld
(JavaWorld.com) – now InfoWorld (www.
infoworld.com/category/java/), informIT
(InformIT.com), Java.net (no longer in existence), SitePoint (SitePoint.
com), and other websites. Jeff can be contacted via his email address:
jefff@xplornet.ca.
xv
Acknowledgments
I am profoundly grateful to my ThoughtWorks colleagues for their
enthusiastic engagement and invaluable contributions during the
development of this book. Our project discussions were a fountain of
insight, enriching the narrative with an array of diverse perspectives. A
special acknowledgment goes to Evan Bottcher for his meticulous review
and for providing an eloquent foreword for the book.
Before embarking on the second edition, I reached out to my
newsletter (https://juntao.substack.com/) subscribers with a survey,
seeking their expectations for the new iteration. The response was
overwhelming and deeply informative – my heartfelt thanks go out to
those dedicated readers who took the time to provide their input.
I must extend my profound appreciation to the editorial team for their
indispensable support throughout the second edition’s journey. Their
expert advice has proven invaluable in refining the text, and it’s their
tireless dedication that has brought this project to fruition.
Finally, upon first sharing my book’s vision with my colleagues
at ThoughtWorks, the outpouring of valuable feedback I received –
spanning from minor typographical corrections to substantial technical
suggestions – was truly overwhelming. In particular, on a cool morning
in May 2020, I was greeted with an uplifting email from Hannah Bourke,
who not only expressed her appreciation for the book but also offered
her editing assistance as a native English speaker and fellow developer.
Her subsequent pull requests offered not just high-quality language
corrections but also insightful technical review comments from a learner’s
perspective.
xvii
Acknowledgments
xviii
Foreword 1
Sometimes, I find it hard to believe that it’s been more than two decades
since Kent Beck published Extreme Programming Explained including
Test-Driven Development (TDD) as a core practice. In the years since then,
the use of automated testing has become quite commonplace, something
that almost all developers are familiar with – however, the “Red-Green-
Refactor” cycle of TDD is often missing. The reality is that building
software test first is not easy or trivial in real-world software development
and requires deliberate practice and usually someone experienced to
learn from.
At ThoughtWorks, my role is Head of Engineering – responsible for the
quality of the software that our teams produce for and with our clients.
We set a high standard for the “internal” quality of the code we produce,
wanting it to be maintainable and extensible so that it can quickly be
changed with confidence. Test-Driven Development is a default practice
in ThoughtWorks – our experience shows that the practice leads to better
software design and good confidence from a comprehensive automated
test suite.
In my years at ThoughtWorks, I’ve seen the phenomenal rise in the
importance of JavaScript and browser applications. In 2010, we advised
that the industry should treat JavaScript as a first-class language (www.
thoughtworks.com/radar/languages-and-frameworks/javascript-
as-a-first-class-language) on the ThoughtWorks Technology Radar,
applying all of the same engineering rigor as other platforms. As one of
the authors of the Technology Radar, I’ve seen and helped document the
explosion of tooling and frameworks in JavaScript, many of which have
been related to the area of test automation.
xix
Foreword 1
Evan Bottcher
March 2021
xx
Foreword 2
Landing in the middle of a React project that had very low test coverage,
in a team that had aspirations to improve it, but without a clear strategy
of how to go about it, I struggled to find resources that stepped out how to
approach testing for a frontend project. I couldn’t find a clear explanation
of how to implement Test-Driven Development for a UI, let alone
specifically for React. This book couldn’t have come at a better time.
There are a plethora of different testing methodologies and libraries
available just for React. The ones you choose will depend on many
things. This book doesn’t prescribe a particular solution but establishes
the purpose of tests in driving out specifications and suggests an overall
approach, with practical guidance and examples. Juntao provides a
holistic explanation of the purpose and implementation of Test-Driven
Development for React, demonstrating the benefits of moving testing
earlier in the process, improving the robustness and design of our code.
Juntao’s years of experience, his eagerness and passion for learning
and sharing his knowledge in a didactic way, help to make this a relevant,
practical, and engaging guide to follow and have given me confidence in
my own testing strategies.
Hannah Bourke
March 2021
xxi
Introduction
This comprehensive book is your ultimate guide to mastering Test-Driven
Development (TDD) in the context of React and TypeScript. Whether you're
a seasoned developer seeking to refine your skills or a newcomer eager to
embrace industry-standard practices, this book caters to all levels of expertise.
Spanning a wide range of topics, each chapter in this book is
thoughtfully designed to provide you with a deep understanding of TDD
principles and their application in real-world scenarios. Let's take a
glimpse into the chapters and their role in your learning journey:
xxiii
Introduction
By following along with each chapter, you'll not only acquire the
knowledge and skills to excel in TDD but also experience the benefits
firsthand. Faster feedback cycles, improved code quality, enhanced
collaboration, and the confidence to make changes and add new features
are just a few of the advantages you'll gain.
Are you ready to embark on a transformative journey toward
becoming a more confident, efficient, and skilled developer? Test-Driven
Development with React and TypeScript: Building Maintainable React
Applications is your comprehensive companion. Let the power of TDD
guide your development process, elevate your coding skills, and lay the
foundation for a successful career in software development. Get ready to
dive in and unlock the full potential of TDD in your React projects.
xxiv
Visit https://ebookmass.com today to explore
a vast collection of ebooks across various
genres, available in popular formats like
PDF, EPUB, and MOBI, fully compatible with
all devices. Enjoy a seamless reading
experience and effortlessly download high-
quality materials in just a few simple steps.
Plus, don’t miss out on exciting offers that
let you access a wealth of knowledge at the
best prices!
Exploring the Variety of Random
Documents with Different Content
SCOTS WHA HAE.
BY ROBERT BURNS.
Ben Jonson was born about the year 1573, at Westminster. Little is
known about his early life, but in 1597 he is found playing and
writing for “The Admiral’s Men,” and later for the “Lord Chamberlain’s
Servants.” Afterwards he stood in great favor at court, and wrote
many of his best plays during that time—the “Alchemist,” “Catiline,”
“Bartholomew Fair,” and “Epicoene.” He died in 1637, after several
years of illness, which affected his wit and brilliancy in such a
manner that many of his later plays were not heard to the end. He
is buried in Westminster Abbey. He also wrote some prose and
some of the most beautiful lyrics of the English language.
Drink to me only with thine eyes,
And I will pledge with mine;
Or leave a kiss but in the cup
And I’ll not look for wine.
The thirst that from the soul doth rise
Doth ask a drink divine;
But might I of Jove’s nectar sup,
I would not change for thine.
I sent thee late a rosy wreath,
Not so much honoring thee
As giving it a hope that there
It could not withered be;
But thou thereon didst only breathe
And sent’st it back to me;
Since when it grows, and smells, I swear,
Not of itself but thee.
A LOVER’S QUARREL.
BY AUSTIN DOBSON.
NELLIE.
If I were you, when ladies at the play, sir,
Beckon and nod, a melodrama through,
I would not turn abstractedly away, sir,
If I were you!
FRANK.
If I were you, when persons I affected,
Wait for three hours to take me down to Kew,
I would, at least, pretend I recollected,
If I were you!
NELLIE.
If I were you, when ladies are so lavish,
Sir, as to keep me every waltz but two,
I would not dance with odious Miss McTavish,
If I were you!
FRANK.
If I were you, who vow you cannot suffer
Whiff of the best—the mildest “honey-dew,”
I would not dance with smoke-consuming Puffer,
If I were you!
NELLIE.
If I were you, I would not, sir, be bitter,
Even to write the “Cynical Review”—
FRANK.
No, I should doubtless find flirtation fitter,
If I were you!
NELLIE.
Really! You would? Why, Frank, you’re quite delightful—
Hot as Othello, and as black of hue;
Borrow my fan. I would not look so frightful,
If I were you!
FRANK.
“It is the cause.” I mean your chaperon is
Bringing some well-curled juvenile. Adieu!
I shall retire. I’d spare that poor Adonis,
If I were you!
NELLIE.
Go, if you will. At once! And by express, sir!
Where shall it be? to China—or Peru?
Go. I should leave inquirers my address, sir,
If I were you!
FRANK.
No—I remain. To stay and fight a duel
Seems on the whole, the proper thing to do—,
Ah, you are strong—I would not then be cruel,
If I were you!
NELLIE.
One does not like one’s feelings to be doubted—
FRANK.
One does not like one’s friends to misconstrue—
NELLIE.
If I confess that I a wee-bit pouted?
FRANK.
I should admit that I was piqued, too.
NELLIE.
Ask me to dance! I’d say no more about it,
If I were you!
(Waltz—Exeunt.)
KUBLA KHAN.
BY SAMUEL T. COLERIDGE.
ebookmasss.com