mirror of
				https://github.com/mastermindzh/rickvanlieshout.com
				synced 2025-10-30 16:20:24 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			31 lines
		
	
	
		
			780 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			780 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import React from "react";
 | |
| import renderer from "react-test-renderer";
 | |
| 
 | |
| import { StaticQuery, useStaticQuery } from "gatsby";
 | |
| import PostTemplate from "./PostTemplate";
 | |
| 
 | |
| import * as mocks from "@/mocks";
 | |
| 
 | |
| const mockedStaticQuery = StaticQuery as jest.Mock;
 | |
| const mockedUseStaticQuery = useStaticQuery as jest.Mock;
 | |
| 
 | |
| describe("PostTemplate", () => {
 | |
|   const props = {
 | |
|     data: {
 | |
|       markdownRemark: mocks.markdownRemark,
 | |
|     },
 | |
|   };
 | |
| 
 | |
|   beforeEach(() => {
 | |
|     mockedStaticQuery.mockImplementationOnce(({ render }) =>
 | |
|       render(mocks.siteMetadata),
 | |
|     );
 | |
|     mockedUseStaticQuery.mockReturnValue(mocks.siteMetadata);
 | |
|   });
 | |
| 
 | |
|   it("renders correctly", () => {
 | |
|     const tree = renderer.create(<PostTemplate {...props} />).toJSON();
 | |
|     expect(tree).toMatchSnapshot();
 | |
|   });
 | |
| });
 |