[tests][m]-add-tests-for-all-pages

This commit is contained in:
Gift Egwuenu
2020-06-03 15:53:21 +01:00
parent dab0865368
commit aea6b830e5
12 changed files with 1039 additions and 32 deletions

View File

@@ -0,0 +1,204 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`showcase renders a snapshot 1`] = `
<div
className="container mx-auto"
>
<div
className="my-16"
>
<div
className="react-me tables"
id="datapackage-view-{{view.id}}"
/>
<p
className="notice"
>
This is a preview version. There might be more data in the original version.
</p>
<div
className="my-16"
>
<h2
className="text-3xl pb-2"
id="data"
>
Remuneración octubre 2017
</h2>
<p
className="text-2xl my-4 font-light"
>
Field Information
</p>
<table
className="table-auto border text-sm mb-2"
>
<thead>
<tr>
<th
className="px-5 w-2/5 text-left py-4 border"
>
Field Name
</th>
<th
className="px-5 w-1/5 text-left py-4 border"
>
Order
</th>
<th
className="px-5 w-1/6 text-left py-4 border"
>
Type(Format)
</th>
<th
className="px-5 w-1/5 text-left py-4 border"
>
Description
</th>
</tr>
</thead>
<tbody>
<tr
className="bg-gray-200 text-sm border"
>
<td
className="px-5 py-4 border font-bold"
>
No.
</td>
<td
className="px-5 py-4 border"
>
1
</td>
<td
className="px-5 py-4 border"
>
any
</td>
<td
className="px-5 py-4 border"
/>
</tr>
<tr
className="text-sm border"
>
<td
className="px-5 py-4 border font-bold"
>
Puesto institucional
</td>
<td
className="px-5 py-4 border"
>
2
</td>
<td
className="px-5 py-4 border"
>
string
</td>
<td
className="px-5 py-4 border"
/>
</tr>
<tr
className="bg-gray-200 text-sm border"
>
<td
className="px-5 py-4 border font-bold"
>
Régimen laboral al que pertenece
</td>
<td
className="px-5 py-4 border"
>
3
</td>
<td
className="px-5 py-4 border"
>
string
</td>
<td
className="px-5 py-4 border"
/>
</tr>
<tr
className="text-sm border"
>
<td
className="px-5 py-4 border font-bold"
>
Número de partida presupuestaria
</td>
<td
className="px-5 py-4 border"
>
4
</td>
<td
className="px-5 py-4 border"
>
string
</td>
<td
className="px-5 py-4 border"
/>
</tr>
<tr
className="bg-gray-200 text-sm border"
>
<td
className="px-5 py-4 border font-bold"
>
Grado jerárquico o escala al que pertenece el puesto
</td>
<td
className="px-5 py-4 border"
>
5
</td>
<td
className="px-5 py-4 border"
>
any
</td>
<td
className="px-5 py-4 border"
/>
</tr>
<tr
className="text-sm border"
>
<td
className="px-5 py-4 border font-bold"
>
Remuneración mensual unificacada
</td>
<td
className="px-5 py-4 border"
>
6
</td>
<td
className="px-5 py-4 border"
>
any
</td>
<td
className="px-5 py-4 border"
/>
</tr>
</tbody>
</table>
<a
className="text-orange-600 underline"
href="/@myorg/myDataset"
>
Go back
</a>
</div>
</div>
</div>
`;

View File

@@ -0,0 +1,17 @@
import React from 'react'
import { render, screen } from '@testing-library/react'
import renderer from 'react-test-renderer'
import Resource from '../../../../../pages/@myorg/myDataset/r/myresource'
test('showcase renders a snapshot', () => {
const tree = renderer.create(<Resource />).toJSON()
expect(tree).toMatchSnapshot()
})
test('render resource page successfully', () => {
const { getByText } = render(<Resource />)
const element = getByText('This is a preview version. There might be more data in the original version.')
const message = 'this is not a preview version'
expect(element).toBeInTheDocument()
expect(screen.queryByText(message)).toBeNull()
})