Skip to content

Commit

Permalink
add chonky code comment
Browse files Browse the repository at this point in the history
  • Loading branch information
jackyzha0 committed Sep 10, 2024
1 parent d4b86fd commit 265cfbb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 1 addition & 4 deletions __tests__/fixtures/cleanup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ import {
} from '../../transport';
import { Server } from '../../router';
import { AnyServiceSchemaMap } from '../../router/services';
import {
numberOfConnections,
testingSessionOptions,
} from '../../testUtil';
import { numberOfConnections, testingSessionOptions } from '../../testUtil';
import { Value } from '@sinclair/typebox/value';
import { ControlMessageAckSchema } from '../../transport/message';

Expand Down
8 changes: 8 additions & 0 deletions __tests__/fixtures/mockTransport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ interface BidiConnection {
handled: boolean;
}

// we construct a network of transports connected by node streams here
// so that we can test the transport layer without needing to actually
// use real network/websocket connections
// this is useful for testing the transport layer in isolation
// and allows us to control network conditions in a way that would be
// difficult with real network connections (e.g. simulating a phantom
// disconnect, .pause() vs .removeAllListeners('data'), congestion,
// latency, differences in ws implementations between node and browsers, etc.)
export function createMockTransportNetwork(opts?: TestTransportOptions): {
getClientTransport: (
id: TransportClientId,
Expand Down

0 comments on commit 265cfbb

Please sign in to comment.