From the course: Building Test-Driven React Components with Copilot
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Refactoring tests - Microsoft Copilot Tutorial
From the course: Building Test-Driven React Components with Copilot
Refactoring tests
- [Instructor] Our tests are working, but there is a bit of a problem here, and that problem has to do with local storage. So sometimes sharing state across different local storage instances can be a little bit troubling, a little bit problematic. So we're going to add a cleanup here between tests. So what we'll do is we'll say add beforeEach to clear localStorage before each test. So we'll give that a save. And we could also put this at the top of the scope actually, so that this happens before each test. Now make sure that that doesn't slow down your testing process too much, but this is a nice feature. I'm going to cancel the test and rerun them just to make sure everything's working as we expect it to. And there we go. Let's also add a little bit of organization here. So let me also add a little bit of organization here. I'm going to say organize these tests into logical groups. And this is going to add a…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Debugging failed tests2m 37s
-
(Locked)
Refactoring tests2m 34s
-
(Locked)
Setting up analytics check3m 47s
-
(Locked)
Generating mock data6m 12s
-
(Locked)
Mocking external dependencies5m 7s
-
(Locked)
Testing user interactions3m 36s
-
(Locked)
Challenge: Testing UI1m 32s
-
(Locked)
Solution: Testing UI3m 18s
-
(Locked)
-
-