fix logging browser tests (#1940)

This commit is contained in:
Andrew Stanton-Nurse 2018-04-10 16:45:17 -07:00 committed by GitHub
parent 3136e5b05f
commit 71be5bf637
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -75,6 +75,7 @@ describe("connection", () => {
// DON'T use commonOptions because we want to specifically test the scenario where logMessageContent is not set.
const connection = new HttpConnection("echo", {
logger: TestLogger.instance,
transport: transportType,
});
@ -86,6 +87,7 @@ describe("connection", () => {
connection.onclose = (error) => {
// Search the logs for the message content
expect(TestLogger.instance.currentLog.messages.length).toBeGreaterThan(0);
for (const [_, logMessage] of TestLogger.instance.currentLog.messages) {
expect(logMessage).not.toContain(message);
}
@ -119,6 +121,7 @@ describe("connection", () => {
connection.onclose = (error) => {
// Search the logs for the message content
let matches = 0;
expect(TestLogger.instance.currentLog.messages.length).toBeGreaterThan(0);
for (const [_, logMessage] of TestLogger.instance.currentLog.messages) {
if (logMessage.indexOf(message) !== -1) {
matches += 1;