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

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.

主站蜘蛛池模板: 泗阳县| 安国市| 金华市| 根河市| 阿瓦提县| 东平县| 万安县| 额济纳旗| 南皮县| 阳江市| 大名县| 鸡东县| 临清市| 泰州市| 衡水市| 新龙县| 延津县| 宣武区| 南和县| 花垣县| 河北省| 南平市| 普兰店市| 巴青县| 苍山县| 寿光市| 富民县| 宜都市| 北海市| 紫阳县| 兰溪市| 莱州市| 梁山县| 淮阳县| 武定县| 峨眉山市| 梁河县| 万州区| 汾西县| 商南县| 汕尾市|