File tree 2 files changed +29
-0
lines changed
2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import { defineConfig, devices } from "@playwright/test";
12
12
*/
13
13
module . exports = defineConfig ( {
14
14
testDir : "./tests" ,
15
+ testMatch : "**/*.spec.js" , // only run *.spec.js files
15
16
/* Run tests in files in parallel */
16
17
fullyParallel : true ,
17
18
/* Fail the build on CI if you accidentally left test.only in the source code. */
Original file line number Diff line number Diff line change
1
+ import { render , screen } from "@testing-library/react" ;
2
+ import { BrowserRouter } from "react-router-dom" ;
3
+ import { describe , expect , it } from "vitest" ;
4
+ import Footer from "../../src/components/Footer" ;
5
+
6
+ describe ( "Footer" , ( ) => {
7
+ const renderWithRouter = ( ui ) => render ( < BrowserRouter > { ui } </ BrowserRouter > ) ;
8
+
9
+ it ( "should render successfully" , ( ) => {
10
+ renderWithRouter ( < Footer /> ) ;
11
+ expect ( screen . getByRole ( "contentinfo" ) ) . toBeTruthy ( ) ;
12
+ } ) ;
13
+
14
+ it ( "displays correct copyright notice" , ( ) => {
15
+ renderWithRouter ( < Footer /> ) ;
16
+ expect (
17
+ screen . getByText ( ( content ) =>
18
+ content . includes ( " SpaceYaTech | All Rights Reserved" )
19
+ )
20
+ ) . toBeTruthy ( ) ;
21
+ } ) ;
22
+
23
+ it ( "renders correct number of links" , ( ) => {
24
+ renderWithRouter ( < Footer /> ) ;
25
+ const links = screen . getAllByRole ( "link" ) ;
26
+ expect ( links ) . toHaveLength ( 15 ) ;
27
+ } ) ;
28
+ } ) ;
You can’t perform that action at this time.
0 commit comments