- Mastering React Test:Driven Development
- Daniel Irvine
- 83字
- 2021-06-24 14:45:03
Promoting variables
Both of our tests use the same two variables: container and customer. We can pull up these declarations to the outer describe scope, but leave the definitions within the tests. Since we'll be splitting declaration and definition, that also means we'll need to use let instead of const:
Just above the first test, write the following two lines:
let container;
let customer;
Then, remove the word const from both of the tests, and re-run your tests, which should still be passing.
推薦閱讀
- C# 7 and .NET Core Cookbook
- Modular Programming with Python
- 體驗設計原理:行為、情感和細節
- Java Web開發之道
- Oracle Exadata專家手冊
- 零基礎學Python網絡爬蟲案例實戰全流程詳解(入門與提高篇)
- Getting Started with Hazelcast(Second Edition)
- Cocos2d-x Game Development Blueprints
- 自學Python:編程基礎、科學計算及數據分析(第2版)
- 計算機應用基礎項目化教程
- 金融商業數據分析:基于Python和SAS
- Learning ECMAScript 6
- Learning WordPress REST API
- Google Maps JavaScript API Cookbook
- OpenStack Sahara Essentials