Bug 1550791 - Re-enable commented mocha test. r=jdescottes.
authorNicolas Chevobbe <nchevobbe@mozilla.com>
Mon, 13 May 2019 14:27:28 +0000
changeset 532427 83c6540f1fc1e9e409cf25e417c74009f3e5ab32
parent 532426 c4671c8a9f62e835109f6911d2fbd243af7dfbb7
child 532428 abaf133a405518a1c014b704c4fe72dc27a018c1
push id11268
push usercsabou@mozilla.com
push dateTue, 14 May 2019 15:24:22 +0000
treeherdermozilla-beta@5fb7fcd568d6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdescottes
bugs1550791, 1535484
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1550791 - Re-enable commented mocha test. r=jdescottes. The test was disabled in Bug 1535484 because it was failing. To fix the test, we need to pass a dispatch prop to the EvaluationResult component. Differential Revision: https://phabricator.services.mozilla.com/D30855
devtools/client/webconsole/test/components/evaluation-result.test.js
--- a/devtools/client/webconsole/test/components/evaluation-result.test.js
+++ b/devtools/client/webconsole/test/components/evaluation-result.test.js
@@ -1,19 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 "use strict";
 
 // Test utils.
 const expect = require("expect");
-const { render } = require("enzyme");
-
-// Commented out for "displays a [Learn more] link"
-// const { render, mount } = require("enzyme");
-// const sinon = require("sinon");
+const { render, mount } = require("enzyme");
+const sinon = require("sinon");
 
 // React
 const { createFactory } = require("devtools/client/shared/vendor/react");
 const Provider = createFactory(require("react-redux").Provider);
 const { setupStore } = require("devtools/client/webconsole/test/helpers");
 
 // Components under test.
 const EvaluationResult = createFactory(
@@ -95,37 +92,40 @@ describe("EvaluationResult component:", 
     const message = stubPreparedMessages.get("cd(document)");
     const wrapper = render(EvaluationResult({ message, serviceContainer }));
 
     expect(wrapper.find(".message-body").text()).toBe(
       "Cannot cd() to the given window. Invalid argument."
     );
   });
 
-  // TODO: Regressed by Bug 1230194, disabled in Bug 1535484. Filed Bug 1550791 to fix it.
-  // it("displays a [Learn more] link", () => {
-  //   const store = setupStore();
+  it("displays a [Learn more] link", () => {
+    const store = setupStore();
 
-  //   const message = stubPreparedMessages.get("asdf()");
-
-  //   serviceContainer.openLink = sinon.spy();
-  //   const wrapper = mount(
-  //     Provider({ store }, EvaluationResult({ message, serviceContainer }))
-  //   );
+    const message = stubPreparedMessages.get("asdf()");
 
-  //   const url =
-  //     "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Errors/Not_defined";
-  //   const learnMore = wrapper.find(".learn-more-link");
-  //   expect(learnMore.length).toBe(1);
-  //   expect(learnMore.prop("title")).toBe(url);
+    serviceContainer.openLink = sinon.spy();
+    const wrapper = mount(
+      Provider({ store }, EvaluationResult({
+        message,
+        serviceContainer,
+        dispatch: () => {},
+      }))
+    );
 
-  //   learnMore.simulate("click");
-  //   const call = serviceContainer.openLink.getCall(0);
-  //   expect(call.args[0]).toEqual(message.exceptionDocURL);
-  // });
+    const url =
+      "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Errors/Not_defined";
+    const learnMore = wrapper.find(".learn-more-link");
+    expect(learnMore.length).toBe(1);
+    expect(learnMore.prop("title")).toBe(url);
+
+    learnMore.simulate("click");
+    const call = serviceContainer.openLink.getCall(0);
+    expect(call.args[0]).toEqual(message.exceptionDocURL);
+  });
 
   it("has the expected indent", () => {
     const message = stubPreparedMessages.get("new Date(0)");
 
     const indent = 10;
     // We need to wrap the ConsoleApiElement in a Provider in order for the
     // ObjectInspector to work.
     let wrapper = render(