@@ -145,14 +145,14 @@ describe('application tests', () => {
145
145
146
146
// site should default to the dark theme
147
147
expect ( toggle ) . toBeChecked ( ) ;
148
- expect ( particles ) . toHaveStyle ( { backgroundColor : ' #000' } ) ;
148
+ expect ( particles ) . toHaveStyle ( 'background-color: #000') ;
149
149
150
150
// click the toggle
151
151
fireEvent . click ( toggle ) ;
152
152
153
153
// the light theme should be visible
154
154
expect ( toggle ) . not . toBeChecked ( ) ;
155
- expect ( particles ) . toHaveStyle ( { backgroundColor : ' #fff' } ) ;
155
+ expect ( particles ) . toHaveStyle ( 'background-color: #fff') ;
156
156
} ) ;
157
157
158
158
it ( 'should render full footer on desktop' , ( ) => {
@@ -180,7 +180,6 @@ describe('app context tests', () => {
180
180
const footer = screen . getByTestId ( 'footer' ) ;
181
181
182
182
expect ( footer ) . toHaveTextContent ( / ^ D e s i g n e d a n d b u i l t b y A d a m A l s t o n $ / ) ;
183
- expect ( footer ) . not . toHaveTextContent ( / S o u r c e / ) ;
184
183
} ) ;
185
184
186
185
describe ( 'reducer tests' , ( ) => {
@@ -203,29 +202,6 @@ describe('local storage tests', () => {
203
202
localStorage . clear ( ) ;
204
203
} ) ;
205
204
206
- it ( "should show the dark theme when 'theme' is set to 'true' in local storage" , async ( ) => {
207
- // set local storage item and render the app
208
- localStorage . setItem ( 'theme' , 'true' ) ;
209
- await act ( async ( ) => render ( < App /> ) ) ;
210
-
211
- // check that the local storage item has been updated correctly
212
- expect ( localStorage . getItem ( 'theme' ) ) . toEqual ( 'dark' ) ;
213
- const particles = screen . getByTestId ( 'particles' ) ;
214
- expect ( particles ) . toHaveStyle ( { backgroundColor : '#000' } ) ;
215
- } ) ;
216
-
217
- it ( "should show the light theme when 'theme' is set to 'false' in local storage" , async ( ) => {
218
- // set local storage item and render the app
219
- localStorage . setItem ( 'theme' , 'false' ) ;
220
- await act ( async ( ) => render ( < App /> ) ) ;
221
-
222
- // check that the local storage item has been updated correctly
223
- expect ( localStorage . getItem ( 'theme' ) ) . toEqual ( 'light' ) ;
224
-
225
- const particles = screen . getByTestId ( 'particles' ) ;
226
- expect ( particles ) . toHaveStyle ( { backgroundColor : '#fff' } ) ;
227
- } ) ;
228
-
229
205
// https://testing-library.com/docs/react-testing-library/api/#rerender
230
206
it ( 'should persist the light theme through an app re-render' , async ( ) => {
231
207
const { rerender } = render ( < App /> ) ;
@@ -238,7 +214,7 @@ describe('local storage tests', () => {
238
214
const particles = screen . getByTestId ( 'particles' ) ;
239
215
240
216
expect ( localStorage . getItem ( 'theme' ) ) . toEqual ( 'light' ) ;
241
- expect ( particles ) . toHaveStyle ( { backgroundColor : ' #fff' } ) ;
217
+ expect ( particles ) . toHaveStyle ( 'background-color: #fff') ;
242
218
} ) ;
243
219
244
220
it ( 'should change local storage value when toggle is clicked' , async ( ) => {
@@ -251,6 +227,6 @@ describe('local storage tests', () => {
251
227
fireEvent . click ( toggle ) ;
252
228
253
229
// check that the local storage item has been changed
254
- expect ( localStorage . getItem ( 'theme' ) ) . not . toEqual ( 'light ' ) ;
230
+ expect ( localStorage . getItem ( 'theme' ) ) . toEqual ( 'dark ' ) ;
255
231
} ) ;
256
232
} ) ;
0 commit comments