官术网_书友最值得收藏!

Displaying data with your first test

The Git tag for this section is appointment-first-name.

In this section, we'll discover the TDD cycle for the first time.

We'll start our application by building out an appointment view. We won't get very far; the tests we'll create in this chapter will simply display the customer who made the appointment. As we do so, we'll discuss the TDD process in detail.

We'll build a React functional component called Appointment. It is used for displaying the details of a single appointment in our system. The component will be passed in a data structure that represents Appointment, which we can imagine looks a little something like this:

{
customer: { firstName: 'Ashley', lastName: 'Jones', phoneNumber: '(123) 555-0123' },
stylist: 'Jay Speares',
startsAt: '2019-02-02 09:30',
service: 'Cut',
notes: ''
}

We won't manage to get all of that information displayed by the time we complete the chapter; in fact, we'll only display the customer's firstName, and we'll make use of the startsAt timestamp to order a list of today's appointments.

But before we get on to that, let's explore Jest a little.

主站蜘蛛池模板: 乌兰察布市| 萍乡市| 佛山市| 日照市| 新民市| 清徐县| 昭通市| 鄂尔多斯市| 凭祥市| 柳江县| 普陀区| 福安市| 揭东县| 北流市| 广河县| 纳雍县| 紫金县| 望奎县| 屏南县| 丹阳市| 遵化市| 玉龙| 乳源| 黄冈市| 阿荣旗| 云阳县| 昆山市| 广安市| 瑞丽市| 泉州市| 南召县| 茌平县| 耿马| 长子县| 通海县| 涞水县| 唐山市| 盱眙县| 建瓯市| 海宁市| 黑龙江省|