[ARVADOS-WORKBENCH2] updated: 1.2.0-577-g1f0f9d2

Git user git at public.curoverse.com
Wed Oct 10 02:56:18 EDT 2018


Summary of changes:
 .../search-bar/search-bar-view.test.tsx            | 27 ++++++++--------------
 1 file changed, 9 insertions(+), 18 deletions(-)

       via  1f0f9d2dad2f31b8429676f92ac99e8d0a48da30 (commit)
      from  1514f6a2ae8103f75f08034299115ad751d8a785 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 1f0f9d2dad2f31b8429676f92ac99e8d0a48da30
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date:   Wed Oct 10 08:56:04 2018 +0200

    test
    
    Feature #14313
    
    Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>

diff --git a/src/views-components/search-bar/search-bar-view.test.tsx b/src/views-components/search-bar/search-bar-view.test.tsx
index d533049..5cd1545 100644
--- a/src/views-components/search-bar/search-bar-view.test.tsx
+++ b/src/views-components/search-bar/search-bar-view.test.tsx
@@ -11,7 +11,7 @@ import * as Adapter from 'enzyme-adapter-react-16';
 
 configure({ adapter: new Adapter() });
 
-describe("<SearchBar />", () => {
+describe("<SearchBarView />", () => {
 
     jest.useFakeTimers();
 
@@ -22,29 +22,23 @@ describe("<SearchBar />", () => {
     });
 
     describe("on submit", () => {
-        it("calls onSearch with initial value passed via props", () => {
-            const searchBar = mount(<SearchBarView {...mockSearchProps()} />);
-            searchBar.find("form").simulate("submit");
-            expect(onSearch).toBeCalledWith("initial value");
-        });
-
         it("calls onSearch with current value", () => {
-            const searchBar = mount(<SearchBarView {...mockSearchProps()} />);
+            const searchBar = mount(<SearchBarView onSearch={onSearch} value="current value" {...mockSearchProps()} />);
             searchBar.find("input").simulate("change", { target: { value: "current value" } });
             searchBar.find("form").simulate("submit");
             expect(onSearch).toBeCalledWith("current value");
         });
 
         it("calls onSearch with new value passed via props", () => {
-            const searchBar = mount(<SearchBarView {...mockSearchProps()} />);
-            searchBar.find("input").simulate("change", { target: { value: "current value" } });
+            const searchBar = mount(<SearchBarView onSearch={onSearch} value="current value" {...mockSearchProps()} />);
+            searchBar.find("input").simulate("change", { target: { value: "new value" } });
             searchBar.setProps({ value: "new value" });
             searchBar.find("form").simulate("submit");
             expect(onSearch).toBeCalledWith("new value");
         });
 
         it("cancels timeout set on input value change", () => {
-            const searchBar = mount(<SearchBarView {...mockSearchProps()} />);
+            const searchBar = mount(<SearchBarView onSearch={onSearch} debounce={1000} value="current value" {...mockSearchProps()} />);
             searchBar.find("input").simulate("change", { target: { value: "current value" } });
             searchBar.find("form").simulate("submit");
             jest.runTimersToTime(1000);
@@ -56,7 +50,7 @@ describe("<SearchBar />", () => {
 
     describe("on input value change", () => {
         it("calls onSearch after default timeout", () => {
-            const searchBar = mount(<SearchBarView {...mockSearchProps()} />);
+            const searchBar = mount(<SearchBarView onSearch={onSearch} value="current value" {...mockSearchProps()} />);
             searchBar.find("input").simulate("change", { target: { value: "current value" } });
             expect(onSearch).not.toBeCalled();
             jest.runTimersToTime(DEFAULT_SEARCH_DEBOUNCE);
@@ -64,7 +58,7 @@ describe("<SearchBar />", () => {
         });
 
         it("calls onSearch after the time specified in props has passed", () => {
-            const searchBar = mount(<SearchBarView {...mockSearchProps()} />);
+            const searchBar = mount(<SearchBarView onSearch={onSearch} value="current value" debounce={2000} {...mockSearchProps()} />);
             searchBar.find("input").simulate("change", { target: { value: "current value" } });
             jest.runTimersToTime(1000);
             expect(onSearch).not.toBeCalled();
@@ -73,7 +67,7 @@ describe("<SearchBar />", () => {
         });
 
         it("calls onSearch only once after no change happened during the specified time", () => {
-            const searchBar = mount(<SearchBarView {...mockSearchProps()} />);
+            const searchBar = mount(<SearchBarView onSearch={onSearch} value="current value" debounce={1000} {...mockSearchProps()} />);
             searchBar.find("input").simulate("change", { target: { value: "current value" } });
             jest.runTimersToTime(500);
             searchBar.find("input").simulate("change", { target: { value: "changed value" } });
@@ -82,7 +76,7 @@ describe("<SearchBar />", () => {
         });
 
         it("calls onSearch again after the specified time has passed since previous call", () => {
-            const searchBar = mount(<SearchBarView {...mockSearchProps()} />);
+            const searchBar = mount(<SearchBarView onSearch={onSearch} value="latest value" debounce={1000} {...mockSearchProps()} />);
             searchBar.find("input").simulate("change", { target: { value: "current value" } });
             jest.runTimersToTime(500);
             searchBar.find("input").simulate("change", { target: { value: "intermediate value" } });
@@ -98,9 +92,6 @@ describe("<SearchBar />", () => {
 });
 
 const mockSearchProps = () => ({
-    value: "current value",
-    onSearch: jest.fn(),
-    debounce: 1000,
     currentView: '',
     open: true,
     onSetView: jest.fn(),

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list