Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions cpp/obs/test/moq-audio-encoder-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,15 +308,6 @@ int main()
CHECK(g_info.type == OBS_ENCODER_AUDIO);
// Hidden from OBS's encoder lists until Use MoQ encoders offers it.
CHECK(g_info.caps & OBS_ENCODER_CAP_INTERNAL);

{
obs_data defaults;
defaults.bitrate = 0;
defaults.preset.clear();
g_info.get_defaults(&defaults);
CHECK(defaults.bitrate == 128);
CHECK(defaults.preset == "balanced");
}
printf("registers an internal Opus encoder: ok\n");

// OBS converts its mix to what the encoder asks for: 48 kHz interleaved float,
Expand Down
5 changes: 0 additions & 5 deletions dart/moq/test/moq_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ void main() {
other.close();
});

test('diagnostic errors expose their named reason', () {
final error = TransportMoqException('reset');
expect(error.reason, 'reset');
});

test('catalog handle closes with its broadcast', () {
final broadcast = BroadcastProducer();
final catalog = moq_media.CatalogProducer(broadcast: broadcast);
Expand Down
8 changes: 1 addition & 7 deletions demo/carla/web/src/paths.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, test } from "bun:test";
import { driverPath, parseCamera } from "./paths.ts";
import { parseCamera } from "./paths.ts";

describe("parseCamera", () => {
test("accepts exactly carla/<truck>/<camera>.hang", () => {
Expand All @@ -19,9 +19,3 @@ describe("parseCamera", () => {
}
});
});

describe("driverPath", () => {
test("roots every driver of a truck under viewer/carla/<truck>", () => {
expect(driverPath("truck1", "abc") as string).toBe("viewer/carla/truck1/abc");
});
});
10 changes: 1 addition & 9 deletions demo/carla/web/src/truck.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as Json from "@moq/json";
import * as Moq from "@moq/net";
import { applyKeys, REST } from "./input.ts";
import type { TruckStatus } from "./schemas.ts";
import { nextGear, SafetyCommandBroadcast, shiftGear, Truck } from "./truck.ts";
import { SafetyCommandBroadcast, shiftGear, Truck } from "./truck.ts";

describe("Truck video demand", () => {
test("only hovered or focused cameras subscribe, and focus suppresses other previews", async () => {
Expand Down Expand Up @@ -458,14 +458,6 @@ describe("Truck respawn", () => {
});
});

describe("nextGear", () => {
test("cycles N → F → R → N", () => {
expect(nextGear("neutral")).toBe("forward");
expect(nextGear("forward")).toBe("reverse");
expect(nextGear("reverse")).toBe("neutral");
});
});

describe("shiftGear", () => {
test("steps one gear at a time", () => {
expect(shiftGear("neutral", 1)).toBe("forward");
Expand Down
8 changes: 0 additions & 8 deletions go/wrapper/errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,6 @@ func TestStreamAbortProtocolDetails(t *testing.T) {
}

func TestErrorMessage(t *testing.T) {
var transport *ffi.MoqErrorTransport
if !errors.As(ffi.NewMoqErrorTransport("reset"), &transport) {
t.Fatal("transport payload is not accessible")
}
if transport.Reason != "reset" {
t.Fatalf("transport reason = %q, want reset", transport.Reason)
}

tests := []struct {
err error
want string
Expand Down
10 changes: 0 additions & 10 deletions go/wrapper/moq_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,6 @@ func opusHead() []byte {
return buf
}

func TestOriginLifecycle(t *testing.T) {
origin := newOrigin(t)
_ = origin.Consume()
dynamic, err := origin.Dynamic("")
if err != nil {
t.Fatal(err)
}
dynamic.Cancel()
}

func TestDynamicBroadcastRequest(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), testTimeout)
defer cancel()
Expand Down
43 changes: 0 additions & 43 deletions js/auth/src/algorithm.test.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,6 @@
import { expect, test } from "bun:test";
import { AlgorithmSchema } from "./algorithm.ts";

test("algorithm schema - valid algorithms", () => {
const validAlgorithms = [
"HS256",
"HS384",
"HS512",
"ES256",
"ES384",
"RS256",
"RS384",
"RS512",
"PS256",
"PS384",
"PS512",
"EdDSA",
] as const;

for (const alg of validAlgorithms) {
expect(AlgorithmSchema.parse(alg)).toBe(alg);
}
});

test("algorithm schema - invalid algorithms", () => {
expect(() => {
AlgorithmSchema.parse("HS128");
Expand All @@ -40,28 +19,6 @@ test("algorithm schema - invalid algorithms", () => {
}).toThrow(/Invalid option|Invalid input/);
});

test("algorithm schema - type safety", () => {
// Test that TypeScript types are working correctly
const validAlgorithm = AlgorithmSchema.parse("HS256");
expect(typeof validAlgorithm === "string").toBeTruthy();
expect(
[
"HS256",
"HS384",
"HS512",
"ES256",
"ES384",
"RS256",
"RS384",
"RS512",
"PS256",
"PS384",
"PS512",
"EdDSA",
].includes(validAlgorithm),
).toBeTruthy();
});

test("algorithm schema - case sensitivity", () => {
expect(() => {
AlgorithmSchema.parse("hs256");
Expand Down
6 changes: 2 additions & 4 deletions js/flate/src/codec.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect, test } from "bun:test";
import { Deflate, Inflate } from "fflate";
import { DEFAULT_MAX_FRAME_SIZE, Decoder, Encoder } from "./codec.ts";
import { Decoder, Encoder } from "./codec.ts";

const enc = new TextEncoder();
const dec = new TextDecoder();
Expand Down Expand Up @@ -72,10 +72,8 @@ test("codec rejects a frame that inflates past the cap", () => {
expect(() => decoder.frame(slice)).toThrow(/exceeded 512/);
});

test("a decoder without options caps frames at 64 MiB", () => {
test("a decoder's frame cap cannot be lifted after construction", () => {
const decoder = new Decoder();
Comment on lines +75 to 76

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep the decompression default pinned to 64 MiB

Restore the exact default-cap assertion. If DEFAULT_MAX_FRAME_SIZE changes while Decoder continues to consume the same constant, this immutability test and the remaining round-trip tests still pass; an increase silently weakens the zip-bomb memory bound, while any drift makes the documented JS default disagree with rs/moq-flate/src/lib.rs.

AGENTS.md reference: AGENTS.md:L18-L18

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping this deleted. The 64 MiB cap is a local resource bound, not a wire contract: each decoder enforces its own, so JS and Rust drifting apart breaks no peer. A literal copy cannot detect drift from Rust either; it only makes a deliberate change edit two lines, and the constant's diff is already in front of the reviewer. The lower bound that does matter stays pinned as an invariant in stream.test.ts (MAX_GROUP_CACHE_BYTES <= DEFAULT_MAX_FRAME_SIZE), and the over-cap rejection is still exercised against the constant. (Written by Claude Opus 5.5)

expect(DEFAULT_MAX_FRAME_SIZE).toBe(64 * 1024 * 1024);
expect(decoder.maxFrameSize).toBe(DEFAULT_MAX_FRAME_SIZE);
expect(() => {
(decoder as { maxFrameSize: number }).maxFrameSize = Infinity;
}).toThrow(TypeError);
Expand Down
36 changes: 0 additions & 36 deletions js/hang/src/catalog/audio.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,42 +37,6 @@ test("audio ranks known zero bitrate above unknown and breaks ties by code point
expect(Catalog.Audio.ranked(renditions).map(([name]) => name)).toEqual(["\uE000", "\u{1F600}", "unknown"]);
});

test("pcm codec is accepted", () => {
const config = AudioConfigSchema.parse({
codec: "pcm",
container: { kind: "legacy" },
sampleRate: 48_000,
numberOfChannels: 2,
bitrate: 3_072_000,
});

expect(config.codec).toBe("pcm");
});

test("audio config accepts a human-readable label", () => {
const config = AudioConfigSchema.parse({
label: "English",
codec: "opus",
container: { kind: "legacy" },
sampleRate: 48_000,
numberOfChannels: 2,
});

expect(config.label).toBe("English");
});

test("audio config accepts optional enabled state", () => {
const config = AudioConfigSchema.parse({
codec: "opus",
container: { kind: "legacy" },
sampleRate: 48_000,
numberOfChannels: 2,
enabled: false,
});

expect(config.enabled).toBe(false);
});

test("audio warmup round trips as optional integer milliseconds", () => {
const base = { codec: "opus", container: { kind: "legacy" }, sampleRate: 48_000, numberOfChannels: 2 };
expect(AudioConfigSchema.parse(base).warmup).toBeUndefined();
Expand Down
7 changes: 3 additions & 4 deletions js/hang/src/catalog/clock.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, test } from "bun:test";
import { ClockSchema, MOQ_EPOCH_UNIX_MILLIS, u53, wallClockTime } from "./index.ts";
import { ClockSchema, MOQ_EPOCH_UNIX_MILLIS, wallClockTime } from "./index.ts";
import { RootSchema } from "./root.ts";

// Mirrors rs/hang/fixtures/catalog-clock.json: the canonical new shape, a root clock plus an
Expand All @@ -20,9 +20,8 @@ const FIXTURE = {
archive: { timelines: { video: { track: "video.timeline.z", duration: 2000 } }, timescale: 1000 },
};

test("timescale defaults to microseconds", () => {
const parsed = ClockSchema.parse({ wall: 1000 });
expect(parsed.timescale).toBe(u53(1_000_000));
test("an omitted timescale means microseconds on the wire", () => {
expect(Number(ClockSchema.parse({ wall: 1000 }).timescale)).toBe(1_000_000);
});

test("a zero timescale is refused", () => {
Expand Down
6 changes: 0 additions & 6 deletions js/hang/src/catalog/data.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ test("an unrecognized mode or compression survives verbatim", () => {
expect(compressionSupported(future?.compression ?? "")).toBe(false);
});

test("the known modes and compressions are recognized", () => {
expect(modeSupported("snapshot")).toBe(true);
expect(modeSupported("stream")).toBe(true);
expect(compressionSupported("deflate")).toBe(true);
});

test("fields belonging to an unrecognized mode survive a round trip", () => {
// Preserving the mode string alone is not enough: a future mode comes with fields describing it,
// and a relay that reparsed and republished would otherwise strip them, leaving an entry nothing
Expand Down
21 changes: 0 additions & 21 deletions js/hang/src/catalog/video.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,6 @@ test("video config accepts canonical display aspect fields", () => {
expect("displayRatioHeight" in parsed).toBe(false);
});

test("video config accepts optional enabled state", () => {
const active = VideoConfigSchema.parse({
codec: "avc1.64001f",
container: { kind: "legacy" },
});
const disabled = VideoConfigSchema.parse({ ...active, enabled: false });

expect(active.enabled).toBeUndefined();
expect(disabled.enabled).toBe(false);
});

test("video config ignores a legacy stalled flag", () => {
const parsed = VideoConfigSchema.parse({
codec: "avc1.64001f",
Expand All @@ -121,16 +110,6 @@ test("video config ignores a legacy stalled flag", () => {
expect(parsed.enabled).toBeUndefined();
});

test("video config accepts a human-readable label", () => {
const config = VideoConfigSchema.parse({
label: "Main camera",
codec: "vp8",
container: { kind: "legacy" },
});

expect(config.label).toBe("Main camera");
});

test("legacy video arrays derive display size from display aspect fields", () => {
const parsed = VideoSchema.parse([
{
Expand Down
3 changes: 1 addition & 2 deletions js/hang/src/stats.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ test("shared invalid counters refuse instead of rounding", async () => {
});

test("feedback discovery agrees with the Rust fixed track and final path suffix", () => {
expect(Echo.TRACK).toBe("feedback.json");
expect(Echo.SUFFIX).toBe(".echo");
expect({ track: Echo.TRACK, suffix: Echo.SUFFIX }).toEqual({ track: "feedback.json", suffix: ".echo" });
expect(Echo.isEcho(Path.from("room/alice.echo"))).toBe(true);
expect(Echo.isEcho(Path.from("room.echo/alice"))).toBe(false);
expect(Echo.isEcho(Path.from("room/alice.echoes"))).toBe(false);
Expand Down
6 changes: 0 additions & 6 deletions js/hang/src/util/opus.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@ describe("supportsRate", () => {
expect(supportsRate(44100)).toBe(false);
expect(supportsRate(22050)).toBe(false);
});

it("accepts the native rates", () => {
for (const rate of SAMPLE_RATES) {
expect(supportsRate(rate)).toBe(true);
}
});
});

describe("toDOps", () => {
Expand Down
6 changes: 1 addition & 5 deletions js/json/src/snapshot/encoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ const MAX_DELTA_FRAMES = 256;
// entrypoint: the Producer needs it to know whether to hold a group open, nothing else does.
export const DEFAULT_DELTA_RATIO = 8;

// Bytes a group may hold before it rolls when {@link Config.maxGroupBytes} is left unset: moq-net's
// per-group cache limit. Not re-exported from the package entrypoint; a test pins it to that limit.
export const DEFAULT_MAX_GROUP_BYTES = Group.MAX_GROUP_CACHE_BYTES;

/** Options shared by an {@link Encoder} and the {@link Producer} that wraps one. */
export interface Config<T> {
// Controls how aggressively the encoder emits deltas (merge patches) instead of full snapshots.
Expand Down Expand Up @@ -153,7 +149,7 @@ export class Encoder<T> {
constructor(config: Config<T> = {}) {
this.#config = config;
this.#compress = isDeflate(config.compression);
this.#maxGroupBytes = config.maxGroupBytes ?? DEFAULT_MAX_GROUP_BYTES;
this.#maxGroupBytes = config.maxGroupBytes ?? Group.MAX_GROUP_CACHE_BYTES;
}

/**
Expand Down
7 changes: 1 addition & 6 deletions js/json/src/snapshot/snapshot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect, test } from "bun:test";
import { Milli } from "@moq/clock";
import { Group, Error as NetError, StreamCode, Time, Track } from "@moq/net";
import { Consumer } from "./consumer.ts";
import { DEFAULT_MAX_GROUP_BYTES, Encoder } from "./encoder.ts";
import { Encoder } from "./encoder.ts";
import { Producer } from "./producer.ts";

type Value = Record<string, unknown>;
Expand Down Expand Up @@ -376,11 +376,6 @@ test("a rejected update leaves the previous value readable", async () => {
expect(await drain(track.subscribe())).toEqual([{ keep: true }]);
});

test("the default group budget is moq-net's group cache limit", () => {
// The tests below shrink the budget, so pin the default they stand in for.
expect(DEFAULT_MAX_GROUP_BYTES).toBe(Group.MAX_GROUP_CACHE_BYTES);
});

test("a delta that would overflow the snapshot rolls a new one instead", async () => {
// A delta is only readable while its group still holds the snapshot it applies to. A patch
// that pushes the group past the budget would abort it, leaving a late subscriber with no
Expand Down
4 changes: 0 additions & 4 deletions js/net/src/connection/cert.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,3 @@ test("certificateHash rejects repeated BEGIN lines in linear time", async () =>
const pem = "-----BEGIN CERTIFICATE-----a".repeat(40_000);
await expect(certificateHash(pem)).rejects.toThrow(/armor/);
});

test("hex round-trips through fromBytes/toBytes", () => {
expect(Hex.fromBytes(Hex.toBytes(ABC_SHA256))).toBe(ABC_SHA256);
});
5 changes: 0 additions & 5 deletions js/net/src/connection/extensions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ async function acceptWith(extensions: Extensions) {
return { pair, peer, connection };
}

test("every extension is offered by default", () => {
expect(offered()).toEqual({ auth: true, solicit: true, epoch: true });
expect(offered({ solicit: false })).toEqual({ auth: true, solicit: false, epoch: true });
});

test("a declined extension stays out of SETUP", async () => {
// Control: both sides offer both.
const all = await handshake({}, {});
Expand Down
16 changes: 0 additions & 16 deletions js/net/src/connection/reload.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,6 @@ async function settle() {
await new Promise((resolve) => setTimeout(resolve, 0));
}

test("enabled defaults to true", () => {
const omitted = new Reload();
const explicitUndefined = new Reload({ enabled: undefined });
const disabled = new Reload({ enabled: false });

try {
expect(omitted.enabled.peek()).toBe(true);
expect(explicitUndefined.enabled.peek()).toBe(true);
expect(disabled.enabled.peek()).toBe(false);
} finally {
omitted.close();
explicitUndefined.close();
disabled.close();
}
});

test("equivalent URL instances do not restart a pending connection", async () => {
const original = globalThis.WebTransport;
let connects = 0;
Expand Down
Loading
Loading