[tests][s]: initial tests for components.
This commit is contained in:
parent
2f8707a6d4
commit
ebfe884b7b
18
__tests__/components/search/Item.test.tsx
Normal file
18
__tests__/components/search/Item.test.tsx
Normal file
@ -0,0 +1,18 @@
|
||||
import React from 'react'
|
||||
import { render } from '@testing-library/react'
|
||||
import renderer from 'react-test-renderer'
|
||||
import Item from '../../../components/search/Item'
|
||||
|
||||
test('📸 of Item component', () => {
|
||||
const datapackage = {
|
||||
name: 'test',
|
||||
title: 'Title',
|
||||
description: 'A description.',
|
||||
organization: {
|
||||
title: 'test org',
|
||||
name: 'test-org'
|
||||
}
|
||||
}
|
||||
const tree = renderer.create(<Item datapackage={datapackage} />).toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
9
__tests__/components/search/Total.test.tsx
Normal file
9
__tests__/components/search/Total.test.tsx
Normal file
@ -0,0 +1,9 @@
|
||||
import React from 'react'
|
||||
import { render } from '@testing-library/react'
|
||||
import renderer from 'react-test-renderer'
|
||||
import Total from '../../../components/search/Total'
|
||||
|
||||
test('📸 of Total component', () => {
|
||||
const tree = renderer.create(<Total total={2} />).toJSON()
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
||||
31
__tests__/components/search/__snapshots__/Item.test.tsx.snap
Normal file
31
__tests__/components/search/__snapshots__/Item.test.tsx.snap
Normal file
@ -0,0 +1,31 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`📸 of Item component 1`] = `
|
||||
<div>
|
||||
<h3
|
||||
className="text-2xl font-semibold"
|
||||
>
|
||||
<a
|
||||
className="text-primary"
|
||||
href="/@test-org/test"
|
||||
onClick={[Function]}
|
||||
onMouseEnter={[Function]}
|
||||
>
|
||||
Title
|
||||
</a>
|
||||
</h3>
|
||||
<a
|
||||
className="text-gray-500 block mt-1"
|
||||
href="/@test-org"
|
||||
onClick={[Function]}
|
||||
onMouseEnter={[Function]}
|
||||
>
|
||||
test org
|
||||
</a>
|
||||
<div
|
||||
className="leading-relaxed mt-2"
|
||||
>
|
||||
A description.
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
@ -0,0 +1,10 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`📸 of Total component 1`] = `
|
||||
<h1
|
||||
className="text-4xl font-semibold text-primary"
|
||||
>
|
||||
2
|
||||
results found
|
||||
</h1>
|
||||
`;
|
||||
Loading…
x
Reference in New Issue
Block a user