Bug 1313688 - Fix mocha tests. r=jdescottes
authorNicolas Chevobbe <chevobbe.nicolas@gmail.com>
Wed, 15 Feb 2017 22:41:45 +0100
changeset 372719 99ef9fe1494c1117de0217892f74e4a5f42bbdf3
parent 372718 a0e7769a42f373dde9a03f5860037141107a5880
child 372720 0d7b8fb5255ec4a872e39bc8dd556cccde146a51
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdescottes
bugs1313688
milestone54.0a1
Bug 1313688 - Fix mocha tests. r=jdescottes MozReview-Commit-ID: J1wGhUEFeQu
devtools/client/webconsole/new-console-output/test/components/console-api-call.test.js
devtools/client/webconsole/new-console-output/test/components/page-error.test.js
--- a/devtools/client/webconsole/new-console-output/test/components/console-api-call.test.js
+++ b/devtools/client/webconsole/new-console-output/test/components/console-api-call.test.js
@@ -19,34 +19,32 @@ const {
   MESSAGE_CLOSE,
 } = require("devtools/client/webconsole/new-console-output/constants");
 const { INDENT_WIDTH } = require("devtools/client/webconsole/new-console-output/components/message-indent");
 
 // Test fakes.
 const { stubPreparedMessages } = require("devtools/client/webconsole/new-console-output/test/fixtures/stubs/index");
 const serviceContainer = require("devtools/client/webconsole/new-console-output/test/fixtures/serviceContainer");
 
-const tempfilePath = "http://example.com/browser/devtools/client/webconsole/new-console-output/test/fixtures/stub-generators/test-tempfile.js";
-
 describe("ConsoleAPICall component:", () => {
   describe("console.log", () => {
     it("renders string grips", () => {
       const message = stubPreparedMessages.get("console.log('foobar', 'test')");
       const wrapper = render(ConsoleApiCall({ message, serviceContainer }));
 
       expect(wrapper.find(".message-body").text()).toBe("foobar test");
       expect(wrapper.find(".objectBox-string").length).toBe(2);
       let selector = "div.message.cm-s-mozilla span span.message-flex-body " +
         "span.message-body.devtools-monospace";
       expect(wrapper.find(selector).length).toBe(1);
 
       // There should be the location
       const locationLink = wrapper.find(`.message-location`);
       expect(locationLink.length).toBe(1);
-      expect(locationLink.text()).toBe("test-tempfile.js:1:27");
+      expect(locationLink.text()).toBe("test-console-api.html:1:27");
     });
 
     it("renders string grips with custom style", () => {
       const message = stubPreparedMessages.get("console.log(%cfoobar)");
       const wrapper = render(ConsoleApiCall({ message, serviceContainer }));
 
       const elements = wrapper.find(".objectBox-string");
       expect(elements.text()).toBe("foobar");
@@ -142,22 +140,24 @@ describe("ConsoleAPICall component:", ()
       expect(wrapper.find(".message-body").text()).toMatch(/^bar: \d+(\.\d+)?ms$/);
     });
   });
 
   describe("console.trace", () => {
     it("renders", () => {
       const message = stubPreparedMessages.get("console.trace()");
       const wrapper = render(ConsoleApiCall({ message, serviceContainer, open: true }));
-      const filepath = `${tempfilePath}`;
+      const filepath = "http://example.com/browser/devtools/client/webconsole/" +
+                       "new-console-output/test/fixtures/stub-generators/" +
+                       "test-console-api.html";
 
       expect(wrapper.find(".message-body").text()).toBe("console.trace()");
 
       const frameLinks = wrapper.find(
-        `.stack-trace span.frame-link[data-url='${filepath}']`);
+        `.stack-trace span.frame-link[data-url]`);
       expect(frameLinks.length).toBe(3);
 
       expect(frameLinks.eq(0).find(".frame-link-function-display-name").text())
         .toBe("testStacktraceFiltering");
       expect(frameLinks.eq(0).find(".frame-link-filename").text())
         .toBe(filepath);
 
       expect(frameLinks.eq(1).find(".frame-link-function-display-name").text())
--- a/devtools/client/webconsole/new-console-output/test/components/page-error.test.js
+++ b/devtools/client/webconsole/new-console-output/test/components/page-error.test.js
@@ -39,17 +39,17 @@ describe("PageError component:", () => {
     // The stacktrace should be closed by default.
     const frameLinks = wrapper.find(`.stack-trace`);
     expect(frameLinks.length).toBe(0);
 
     // There should be the location.
     const locationLink = wrapper.find(`.message-location`);
     expect(locationLink.length).toBe(1);
     // @TODO Will likely change. See bug 1307952
-    expect(locationLink.text()).toBe("test-tempfile.js:3:5");
+    expect(locationLink.text()).toBe("test-console-api.html:3:5");
   });
 
   it("displays a [Learn more] link", () => {
     const store = setupStore([]);
 
     const message = stubPreparedMessages.get("ReferenceError: asdf is not defined");
 
     serviceContainer.openLink = sinon.spy();
@@ -71,19 +71,19 @@ describe("PageError component:", () => {
 
   it("has a stacktrace which can be openned", () => {
     const message = stubPreparedMessages.get("ReferenceError: asdf is not defined");
     const wrapper = render(PageError({ message, serviceContainer, open: true }));
 
     // There should be a collapse button.
     expect(wrapper.find(".theme-twisty.open").length).toBe(1);
 
-    // There should be three stacktrace items.
+    // There should be five stacktrace items.
     const frameLinks = wrapper.find(`.stack-trace span.frame-link`);
-    expect(frameLinks.length).toBe(3);
+    expect(frameLinks.length).toBe(5);
   });
 
   it("toggle the stacktrace when the collapse button is clicked", () => {
     const store = setupStore([]);
     store.dispatch = sinon.spy();
     const message = stubPreparedMessages.get("ReferenceError: asdf is not defined");
 
     let wrapper = mount(Provider({store},