Bug 1486768 - Fix mocha tests;r=Honza.

Some tests were failing because of change in the code:
- arrow icon don't have an expanded class anymore but use aria-expanded
- executionPoint property wasn't set on the ConsoleMessageType
- networkUpdateRequest action expects a second argument
- requestHeadersFromUploadStream is retrieved from requestPostData.uploadHeaders

Differential Revision: https://phabricator.services.mozilla.com/D4444

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicolas Chevobbe 2018-08-30 10:42:43 +00:00
Родитель 12bc352965
Коммит 8ed23b0cda
5 изменённых файлов: 16 добавлений и 12 удалений

Просмотреть файл

@ -322,7 +322,7 @@ describe("ConsoleAPICall component:", () => {
const wrapper = render(ConsoleApiCall({ message, serviceContainer, open: true }));
expect(wrapper.find(".message-body").text()).toBe("bar");
expect(wrapper.find(".collapse-button.expanded").length).toBe(1);
expect(wrapper.find(".collapse-button[aria-expanded=true]").length).toBe(1);
});
it("renders group with custom style", () => {
@ -362,7 +362,7 @@ describe("ConsoleAPICall component:", () => {
serviceContainer,
})
));
wrapper.find(".collapse-button.expanded").simulate("click");
wrapper.find(".collapse-button[aria-expanded='true']").simulate("click");
let call = store.dispatch.getCall(0);
expect(call.args[0]).toEqual({
id: message.id,

Просмотреть файл

@ -114,7 +114,7 @@ describe("PageError component:", () => {
const wrapper = render(PageError({ message, serviceContainer, open: true }));
// There should be a collapse button.
expect(wrapper.find(".collapse-button.expanded").length).toBe(1);
expect(wrapper.find(".collapse-button[aria-expanded=true]").length).toBe(1);
// There should be five stacktrace items.
const frameLinks = wrapper.find(`.stack-trace span.frame-link`);
@ -134,7 +134,8 @@ describe("PageError component:", () => {
serviceContainer,
})
));
wrapper.find(".collapse-button.expanded").simulate("click");
wrapper.find(".collapse-button[aria-expanded='true']").simulate("click");
let call = store.dispatch.getCall(0);
expect(call.args[0]).toEqual({
id: message.id,
@ -149,7 +150,7 @@ describe("PageError component:", () => {
serviceContainer,
})
));
wrapper.find(".collapse-button").simulate("click");
wrapper.find(".collapse-button[aria-expanded='false']").simulate("click");
call = store.dispatch.getCall(1);
expect(call.args[0]).toEqual({
id: message.id,

Просмотреть файл

@ -67,19 +67,21 @@ describe("Network message reducer:", () => {
});
it("adds fetched HTTP post data", () => {
const uploadHeaders = Symbol();
const requestPostData = {
postData: {
text: ""
}
},
uploadHeaders,
};
dispatch(actions.networkUpdateRequest("message1", {
requestPostData: requestPostData
requestPostData,
}));
const networkUpdates = getAllNetworkMessagesUpdateById(getState());
expect(networkUpdates.message1.requestPostData).toBe(requestPostData);
expect(networkUpdates.message1.requestHeadersFromUploadStream).toExist();
const {message1} = getAllNetworkMessagesUpdateById(getState());
expect(message1.requestPostData).toBe(requestPostData);
expect(message1.requestHeadersFromUploadStream).toBe(uploadHeaders);
});
});
});

Просмотреть файл

@ -156,8 +156,8 @@ describe("private messages", () => {
const publicMessageId = getFirstMessage(state).id;
const privateMessageId = getLastMessage(state).id;
dispatch(actions.networkUpdateRequest(publicMessageId));
dispatch(actions.networkUpdateRequest(privateMessageId));
dispatch(actions.networkUpdateRequest(publicMessageId, {}));
dispatch(actions.networkUpdateRequest(privateMessageId, {}));
let networkUpdates = getAllNetworkMessagesUpdateById(getState());
expect(Object.keys(networkUpdates)).toEqual([publicMessageId, privateMessageId]);

Просмотреть файл

@ -41,6 +41,7 @@ exports.ConsoleMessage = function(props) {
frame: null,
groupId: null,
exceptionDocURL: null,
executionPoint: undefined,
userProvidedStyles: null,
notes: null,
indent: 0,