From aed19ca80d889aa86ac8735116809670be2a8c30 Mon Sep 17 00:00:00 2001 From: An Duong Date: Wed, 13 May 2020 11:16:29 +0700 Subject: [PATCH] chore: #1185 add some test --- .../__snapshots__/webhook-test-modal.tsx.snap | 89 +++++++------------ .../ui/__tests__/webhook-test-modal.tsx | 8 +- .../src/tests/badges/badge-branches.svg | 2 +- .../src/tests/badges/badge-functions.svg | 2 +- .../src/tests/badges/badge-lines.svg | 2 +- .../src/tests/badges/badge-statements.svg | 2 +- 6 files changed, 40 insertions(+), 65 deletions(-) diff --git a/packages/marketplace/src/components/ui/__tests__/__snapshots__/webhook-test-modal.tsx.snap b/packages/marketplace/src/components/ui/__tests__/__snapshots__/webhook-test-modal.tsx.snap index 59b9793ff8..4df6aad6c0 100644 --- a/packages/marketplace/src/components/ui/__tests__/__snapshots__/webhook-test-modal.tsx.snap +++ b/packages/marketplace/src/components/ui/__tests__/__snapshots__/webhook-test-modal.tsx.snap @@ -1,34 +1,15 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`WebhookTestModal should WebhookTestModal match a snapshot 1`] = ` - @@ -37,42 +18,34 @@ exports[`WebhookTestModal should WebhookTestModal match a snapshot 1`] = ` closeModal={[MockFunction]} visible={true} webhookId="webhookId" - /> - + > + + + `; exports[`WebhookTestModal should WebhookTestResultModal match a snapshot 1`] = ` - - - + + + + `; diff --git a/packages/marketplace/src/components/ui/__tests__/webhook-test-modal.tsx b/packages/marketplace/src/components/ui/__tests__/webhook-test-modal.tsx index 2d84578606..bdb4354f72 100644 --- a/packages/marketplace/src/components/ui/__tests__/webhook-test-modal.tsx +++ b/packages/marketplace/src/components/ui/__tests__/webhook-test-modal.tsx @@ -1,5 +1,5 @@ import React from 'react' -import { shallow } from 'enzyme' +import { mount } from 'enzyme' import { generateTopicOptions, fetchWebhookData, @@ -10,6 +10,7 @@ import { WebhookTestModal, GenerateTopicOptions, } from '../webhook-test-modal' +import * as TestModal from '../webhook-test-modal' import { ReduxState } from '@/types/core' import * as ReactRedux from 'react-redux' import { developerState } from '@/sagas/__stubs__/developer' @@ -39,8 +40,9 @@ describe('WebhookTestModal', () => { // spyDispatch = jest.spyOn(ReactRedux, 'useDispatch').mockImplementation(() => store.dispatch) }) it('should WebhookTestModal match a snapshot', () => { + spyOn(TestModal, 'generateTopicOptions').and.returnValue([]) expect( - shallow( + mount( , @@ -50,7 +52,7 @@ describe('WebhookTestModal', () => { it('should WebhookTestResultModal match a snapshot', () => { expect( - shallow( + mount( , diff --git a/packages/marketplace/src/tests/badges/badge-branches.svg b/packages/marketplace/src/tests/badges/badge-branches.svg index 91d29a720c..4425a6eff6 100644 --- a/packages/marketplace/src/tests/badges/badge-branches.svg +++ b/packages/marketplace/src/tests/badges/badge-branches.svg @@ -1 +1 @@ -Coverage:branchesCoverage:branches69.8%69.8% \ No newline at end of file +Coverage:branchesCoverage:branches70.2%70.2% \ No newline at end of file diff --git a/packages/marketplace/src/tests/badges/badge-functions.svg b/packages/marketplace/src/tests/badges/badge-functions.svg index b8299e37d9..2381b7cd36 100644 --- a/packages/marketplace/src/tests/badges/badge-functions.svg +++ b/packages/marketplace/src/tests/badges/badge-functions.svg @@ -1 +1 @@ -Coverage:functionsCoverage:functions74.73%74.73% \ No newline at end of file +Coverage:functionsCoverage:functions74.91%74.91% \ No newline at end of file diff --git a/packages/marketplace/src/tests/badges/badge-lines.svg b/packages/marketplace/src/tests/badges/badge-lines.svg index 27b362eff0..0b03c4e817 100644 --- a/packages/marketplace/src/tests/badges/badge-lines.svg +++ b/packages/marketplace/src/tests/badges/badge-lines.svg @@ -1 +1 @@ -Coverage:linesCoverage:lines89.29%89.29% \ No newline at end of file +Coverage:linesCoverage:lines89.62%89.62% \ No newline at end of file diff --git a/packages/marketplace/src/tests/badges/badge-statements.svg b/packages/marketplace/src/tests/badges/badge-statements.svg index 672429f0c4..eb928e1fd2 100644 --- a/packages/marketplace/src/tests/badges/badge-statements.svg +++ b/packages/marketplace/src/tests/badges/badge-statements.svg @@ -1 +1 @@ -Coverage:statementsCoverage:statements88.44%88.44% \ No newline at end of file +Coverage:statementsCoverage:statements88.75%88.75% \ No newline at end of file