Cleanup logs during test (#1787)
This commit is contained in:
parent
0362905a70
commit
c0418319fe
|
|
@ -136,6 +136,7 @@ describe("HttpConnection", () => {
|
||||||
|
|
||||||
it("start throws after all transports fail", async (done) => {
|
it("start throws after all transports fail", async (done) => {
|
||||||
const options: IHttpConnectionOptions = {
|
const options: IHttpConnectionOptions = {
|
||||||
|
...commonOptions,
|
||||||
httpClient: new TestHttpClient()
|
httpClient: new TestHttpClient()
|
||||||
.on("POST", (r) => ({ connectionId: "42", availableTransports: [] }))
|
.on("POST", (r) => ({ connectionId: "42", availableTransports: [] }))
|
||||||
.on("GET", (r) => { throw new Error("fail"); }),
|
.on("GET", (r) => { throw new Error("fail"); }),
|
||||||
|
|
@ -343,14 +344,14 @@ describe("HttpConnection", () => {
|
||||||
describe("startAsync", () => {
|
describe("startAsync", () => {
|
||||||
it("throws if no TransferFormat is provided", async () => {
|
it("throws if no TransferFormat is provided", async () => {
|
||||||
// Force TypeScript to let us call start incorrectly
|
// Force TypeScript to let us call start incorrectly
|
||||||
const connection: any = new HttpConnection("http://tempuri.org");
|
const connection: any = new HttpConnection("http://tempuri.org", commonOptions);
|
||||||
|
|
||||||
expect(() => connection.start()).toThrowError("The 'transferFormat' argument is required.");
|
expect(() => connection.start()).toThrowError("The 'transferFormat' argument is required.");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("throws if an unsupported TransferFormat is provided", async () => {
|
it("throws if an unsupported TransferFormat is provided", async () => {
|
||||||
// Force TypeScript to let us call start incorrectly
|
// Force TypeScript to let us call start incorrectly
|
||||||
const connection: any = new HttpConnection("http://tempuri.org");
|
const connection: any = new HttpConnection("http://tempuri.org", commonOptions);
|
||||||
|
|
||||||
expect(() => connection.start(42)).toThrowError("Unknown transferFormat value: 42.");
|
expect(() => connection.start(42)).toThrowError("Unknown transferFormat value: 42.");
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -233,7 +233,6 @@ describe("HubConnection", () => {
|
||||||
|
|
||||||
connection.receive({
|
connection.receive({
|
||||||
arguments: ["test"],
|
arguments: ["test"],
|
||||||
invocationId: "0",
|
|
||||||
nonblocking: true,
|
nonblocking: true,
|
||||||
target: "message",
|
target: "message",
|
||||||
type: MessageType.Invocation,
|
type: MessageType.Invocation,
|
||||||
|
|
@ -273,7 +272,7 @@ describe("HubConnection", () => {
|
||||||
|
|
||||||
it("all handlers can be unregistered with just the method name", async () => {
|
it("all handlers can be unregistered with just the method name", async () => {
|
||||||
const connection = new TestConnection();
|
const connection = new TestConnection();
|
||||||
const hubConnection = new HubConnection(connection);
|
const hubConnection = new HubConnection(connection, commonOptions);
|
||||||
|
|
||||||
connection.receiveHandshakeResponse();
|
connection.receiveHandshakeResponse();
|
||||||
|
|
||||||
|
|
@ -306,7 +305,7 @@ describe("HubConnection", () => {
|
||||||
|
|
||||||
it("a single handler can be unregistered with the method name and handler", async () => {
|
it("a single handler can be unregistered with the method name and handler", async () => {
|
||||||
const connection = new TestConnection();
|
const connection = new TestConnection();
|
||||||
const hubConnection = new HubConnection(connection);
|
const hubConnection = new HubConnection(connection, commonOptions);
|
||||||
|
|
||||||
connection.receiveHandshakeResponse();
|
connection.receiveHandshakeResponse();
|
||||||
|
|
||||||
|
|
@ -339,7 +338,7 @@ describe("HubConnection", () => {
|
||||||
|
|
||||||
it("can't register the same handler multiple times", async () => {
|
it("can't register the same handler multiple times", async () => {
|
||||||
const connection = new TestConnection();
|
const connection = new TestConnection();
|
||||||
const hubConnection = new HubConnection(connection);
|
const hubConnection = new HubConnection(connection, commonOptions);
|
||||||
|
|
||||||
connection.receiveHandshakeResponse();
|
connection.receiveHandshakeResponse();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue