From fa6dfb0395826041349c604edcbcbaa316fc95d8 Mon Sep 17 00:00:00 2001 From: Shin'ya UEOKA Date: Sun, 6 Oct 2019 12:51:43 +0000 Subject: Add partial blacklist form --- .../components/form/BlacklistForm.test.tsx | 25 ++++++++++++---------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'test/settings/components') diff --git a/test/settings/components/form/BlacklistForm.test.tsx b/test/settings/components/form/BlacklistForm.test.tsx index 2be5d96..7daf513 100644 --- a/test/settings/components/form/BlacklistForm.test.tsx +++ b/test/settings/components/form/BlacklistForm.test.tsx @@ -2,13 +2,16 @@ import React from 'react'; import ReactDOM from 'react-dom'; import ReactTestRenderer from 'react-test-renderer'; import ReactTestUtils from 'react-dom/test-utils'; -import BlacklistForm from 'settings/components/form/BlacklistForm' +import { expect } from 'chai' + +import BlacklistForm from '../../../../src/settings/components/form/BlacklistForm' +import Blacklist from '../../../../src/shared/settings/Blacklist'; describe("settings/form/BlacklistForm", () => { describe('render', () => { it('renders BlacklistForm', () => { let root = ReactTestRenderer.create( - , + , ).root; let children = root.children[0].children; @@ -43,10 +46,10 @@ describe("settings/form/BlacklistForm", () => { it('invokes onChange event on edit', (done) => { ReactTestUtils.act(() => { ReactDOM.render( { - expect(value).to.have.lengthOf(2); - expect(value).to.have.members(['gitter.im', 'www.google.com/maps*']); + let urls = value.items.map(item => item.pattern); + expect(urls).to.have.members(['gitter.im', 'www.google.com/maps*']); done(); }} />, container) @@ -60,10 +63,10 @@ describe("settings/form/BlacklistForm", () => { it('invokes onChange event on delete', (done) => { ReactTestUtils.act(() => { ReactDOM.render( { - expect(value).to.have.lengthOf(1); - expect(value).to.have.members(['www.google.com/maps*']); + let urls = value.items.map(item => item.pattern); + expect(urls).to.have.members(['www.google.com/maps*']); done(); }} />, container) @@ -76,10 +79,10 @@ describe("settings/form/BlacklistForm", () => { it('invokes onChange event on add', (done) => { ReactTestUtils.act(() => { ReactDOM.render( { - expect(value).to.have.lengthOf(2); - expect(value).to.have.members(['*.slack.com', '']); + let urls = value.items.map(item => item.pattern); + expect(urls).to.have.members(['*.slack.com', '']); done(); }} />, container); -- cgit v1.2.3