- 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++ Builder 6.0下OpenGL編程技術
- 趣學Python算法100例
- Learning Neo4j 3.x(Second Edition)
- Learning OpenCV 3 Computer Vision with Python(Second Edition)
- 批調度與網絡問題的組合算法
- C語言程序設計上機指導與習題解答(第2版)
- Swift 4從零到精通iOS開發
- Image Processing with ImageJ
- Learning Splunk Web Framework
- C++程序設計教程(第2版)
- C編程技巧:117個問題解決方案示例
- 黑莓(BlackBerry)開發從入門到精通
- Microsoft Dynamics GP 2013 Cookbook
- Java性能權威指南