aboutsummaryrefslogtreecommitdiff
path: root/test/settings/components/form
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2019-10-09 11:50:52 +0000
committerGitHub <noreply@github.com>2019-10-09 11:50:52 +0000
commit18c72bf15c6bc7e4c88dd06d38ff861f29d66b1b (patch)
treef46720349e17c57db7bbfc55241b12c4410f2773 /test/settings/components/form
parent8eddcc1785a85bbe74be254d1055ebe5125dad10 (diff)
parent68f6211aac4177f3a70a40031dabbd1b61840071 (diff)
Merge pull request #655 from ueokande/partial-blacklist
Partial blacklist
Diffstat (limited to 'test/settings/components/form')
-rw-r--r--test/settings/components/form/BlacklistForm.test.tsx25
1 files changed, 14 insertions, 11 deletions
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(
- <BlacklistForm value={['*.slack.com', 'www.google.com/maps']} />,
+ <BlacklistForm value={Blacklist.fromJSON(['*.slack.com', 'www.google.com/maps'])} />,
).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(<BlacklistForm
- value={['*.slack.com', 'www.google.com/maps*']}
+ value={Blacklist.fromJSON(['*.slack.com', 'www.google.com/maps*'])}
onChange={value => {
- 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(<BlacklistForm
- value={['*.slack.com', 'www.google.com/maps*']}
+ value={Blacklist.fromJSON(['*.slack.com', 'www.google.com/maps*'])}
onChange={value => {
- 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(<BlacklistForm
- value={['*.slack.com']}
+ value={Blacklist.fromJSON(['*.slack.com'])}
onChange={value => {
- 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);