File tree 2 files changed +34
-2
lines changed
site/src/pages/TemplatePage 2 files changed +34
-2
lines changed Original file line number Diff line number Diff line change
1
+ import { screen } from "@testing-library/react"
2
+ import { TemplateLayout } from "components/TemplateLayout/TemplateLayout"
3
+ import { ResizeObserver } from "resize-observer"
4
+ import {
5
+ MockTemplate ,
6
+ renderWithAuth ,
7
+ } from "testHelpers/renderHelpers"
8
+ import TemplateDocsPage from "./TemplateDocsPage"
9
+
10
+ jest . mock ( "remark-gfm" , ( ) => jest . fn ( ) )
11
+
12
+ Object . defineProperty ( window , "ResizeObserver" , {
13
+ value : ResizeObserver ,
14
+ } )
15
+
16
+ const renderPage = ( ) =>
17
+ renderWithAuth (
18
+ < TemplateLayout >
19
+ < TemplateDocsPage />
20
+ </ TemplateLayout > ,
21
+ {
22
+ route : `/templates/${ MockTemplate . id } /docs` ,
23
+ path : "/templates/:template/docs" ,
24
+ } ,
25
+ )
26
+
27
+ describe ( "TemplateSummaryPage" , ( ) => {
28
+ it ( "shows the template readme" , async ( ) => {
29
+ renderPage ( )
30
+ await screen . findByText ( MockTemplate . display_name )
31
+ await screen . findByTestId ( "markdown" )
32
+ } )
33
+ } )
Original file line number Diff line number Diff line change @@ -31,14 +31,13 @@ const renderPage = () =>
31
31
)
32
32
33
33
describe ( "TemplateSummaryPage" , ( ) => {
34
- it ( "shows the template name, readme and resources" , async ( ) => {
34
+ it ( "shows the template name and resources" , async ( ) => {
35
35
// Mocking the dayjs module within the createDayString file
36
36
const mock = jest . spyOn ( CreateDayString , "createDayString" )
37
37
mock . mockImplementation ( ( ) => "a minute ago" )
38
38
39
39
renderPage ( )
40
40
await screen . findByText ( MockTemplate . display_name )
41
- await screen . findByTestId ( "markdown" )
42
41
screen . getByText ( MockWorkspaceResource . name )
43
42
screen . queryAllByText ( `${ MockTemplateVersion . name } ` ) . length
44
43
} )
You can’t perform that action at this time.
0 commit comments