File tree 5 files changed +87
-0
lines changed
5 files changed +87
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : 🧪 Unit Tests (Jest)
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - main
7
+ pull_request :
8
+ types : [opened, synchronize, reopened]
9
+
10
+ jobs :
11
+ build :
12
+ name : 🧪 Unit Tests (Jest)
13
+ runs-on : ubuntu-latest
14
+ steps :
15
+ - uses : actions/checkout@v3
16
+ - name : 📦 Install modules
17
+ run : npm install
18
+ - name : ⚙️ Run tests
19
+ run : npm run test --coverage
Original file line number Diff line number Diff line change @@ -14,6 +14,20 @@ npm run dev
14
14
15
15
Open [ http://localhost:3000 ] ( http://localhost:3000 ) with your browser to see the result.
16
16
17
+ ## Tests
18
+
19
+ ### Unit Tests
20
+
21
+ Run all [ Jest] ( https://jestjs.io/ ) and [ React Testing Library] ( https://testing-library.com/docs/react-testing-library/intro ) unit tests:
22
+
23
+ ``` bash
24
+ npm run test
25
+ ```
26
+
27
+ Launches the test runner in the interactive watch mode.
28
+
29
+ Tests are colocated and live as closely to corresponding code as possible.
30
+
17
31
## Deploy
18
32
19
33
The app is based on [ Next.JS] ( https://nextjs.org/ ) and is automatically built & deployed to GitHub Pages when pushing to the ` main ` branch.
Original file line number Diff line number Diff line change
1
+ import { render } from "@testing-library/react" ;
2
+ import { RekorClientProvider } from "../api/context" ;
3
+ import { EntryCard } from "./Entry" ;
4
+
5
+ describe ( "Entry" , ( ) => {
6
+ it ( "renders" , ( ) => {
7
+ //
8
+ } ) ;
9
+ } ) ;
10
+
11
+ describe ( "EntryCard" , ( ) => {
12
+ it ( "renders" , ( ) => {
13
+ render (
14
+ < RekorClientProvider >
15
+ < EntryCard
16
+ content = { < > </ > }
17
+ title = { < > </ > }
18
+ />
19
+ </ RekorClientProvider > ,
20
+ ) ;
21
+ } ) ;
22
+ } ) ;
Original file line number Diff line number Diff line change
1
+ import { SearchForm } from "./SearchForm" ;
2
+ import { render } from "@testing-library/react" ;
3
+ import { RekorClientProvider } from "../api/context" ;
4
+
5
+ describe ( "SearchForm" , ( ) => {
6
+ it ( "renders" , ( ) => {
7
+ render (
8
+ < RekorClientProvider >
9
+ < SearchForm
10
+ isLoading = { false }
11
+ onSubmit = { ( ) => { } }
12
+ />
13
+ </ RekorClientProvider > ,
14
+ ) ;
15
+ } ) ;
16
+ } ) ;
Original file line number Diff line number Diff line change
1
+ import { render } from "@testing-library/react" ;
2
+ import { RekorClientProvider } from "../api/context" ;
3
+ import { Settings } from "./Settings" ;
4
+
5
+ describe ( "Settings" , ( ) => {
6
+ it ( "renders" , ( ) => {
7
+ render (
8
+ < RekorClientProvider >
9
+ < Settings
10
+ onClose = { jest . fn ( ) }
11
+ open = { true }
12
+ />
13
+ </ RekorClientProvider > ,
14
+ ) ;
15
+ } ) ;
16
+ } ) ;
You can’t perform that action at this time.
0 commit comments