From ebfe884b7b2d64a10cc6c62d1a67dc43175e9e94 Mon Sep 17 00:00:00 2001 From: anuveyatsu Date: Fri, 12 Jun 2020 16:16:56 +0600 Subject: [PATCH] [tests][s]: initial tests for components. --- __tests__/components/search/Item.test.tsx | 18 +++++++++++ __tests__/components/search/Total.test.tsx | 9 ++++++ .../search/__snapshots__/Item.test.tsx.snap | 31 +++++++++++++++++++ .../search/__snapshots__/Total.test.tsx.snap | 10 ++++++ 4 files changed, 68 insertions(+) create mode 100644 __tests__/components/search/Item.test.tsx create mode 100644 __tests__/components/search/Total.test.tsx create mode 100644 __tests__/components/search/__snapshots__/Item.test.tsx.snap create mode 100644 __tests__/components/search/__snapshots__/Total.test.tsx.snap diff --git a/__tests__/components/search/Item.test.tsx b/__tests__/components/search/Item.test.tsx new file mode 100644 index 00000000..cda1194c --- /dev/null +++ b/__tests__/components/search/Item.test.tsx @@ -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().toJSON() + expect(tree).toMatchSnapshot() +}) diff --git a/__tests__/components/search/Total.test.tsx b/__tests__/components/search/Total.test.tsx new file mode 100644 index 00000000..a30f60a0 --- /dev/null +++ b/__tests__/components/search/Total.test.tsx @@ -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().toJSON() + expect(tree).toMatchSnapshot() +}) diff --git a/__tests__/components/search/__snapshots__/Item.test.tsx.snap b/__tests__/components/search/__snapshots__/Item.test.tsx.snap new file mode 100644 index 00000000..7aea4813 --- /dev/null +++ b/__tests__/components/search/__snapshots__/Item.test.tsx.snap @@ -0,0 +1,31 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`📸 of Item component 1`] = ` +
+

+ + Title + +

+ + test org + +
+ A description. +
+
+`; diff --git a/__tests__/components/search/__snapshots__/Total.test.tsx.snap b/__tests__/components/search/__snapshots__/Total.test.tsx.snap new file mode 100644 index 00000000..1a202222 --- /dev/null +++ b/__tests__/components/search/__snapshots__/Total.test.tsx.snap @@ -0,0 +1,10 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`📸 of Total component 1`] = ` +

+ 2 + results found +

+`;