improvement: flow coverage

This commit is contained in:
alxshelepenok
2019-05-10 02:15:43 +03:00
parent 091834f16a
commit 35f2170bf5
66 changed files with 308 additions and 56 deletions

View File

@@ -1,8 +1,14 @@
// @flow
import React from 'react';
import ReactDisqusComments from 'react-disqus-comments';
import { useSiteMetadata } from '../../../hooks';
const Comments = ({ postTitle, postSlug }) => {
type Props = {
postTitle: string,
postSlug: string
};
const Comments = ({ postTitle, postSlug }: Props) => {
const { url, disqusShortname } = useSiteMetadata();
if (!disqusShortname) {

View File

@@ -1,13 +1,15 @@
// @flow
import React from 'react';
import renderer from 'react-test-renderer';
import { useStaticQuery, StaticQuery } from 'gatsby';
import Comments from './Comments';
import siteMetadata from '../../../../jest/__fixtures__/site-metadata';
import type { RenderCallback } from '../../../types';
describe('Comments', () => {
beforeEach(() => {
StaticQuery.mockImplementationOnce(
({ render }) => (
({ render }: RenderCallback) => (
render(siteMetadata)
),
useStaticQuery.mockReturnValue(siteMetadata)

View File

@@ -1 +1,2 @@
// @flow
export { default } from './Comments';