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