@quake2ts/test-utils 0.0.869 → 0.0.873

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
5
5
  throw Error('Dynamic require of "' + x + '" is not supported');
6
6
  });
7
7
 
8
- // ../../node_modules/.pnpm/tsup@8.5.1_tsx@4.21.0_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js
8
+ // ../../node_modules/.pnpm/tsup@8.5.1_postcss@8.5.6_tsx@4.21.0_typescript@5.9.3/node_modules/tsup/assets/esm_shims.js
9
9
  import path from "path";
10
10
  import { fileURLToPath } from "url";
11
11
  var getFilename = () => fileURLToPath(import.meta.url);
@@ -1413,20 +1413,20 @@ function createMockPowerupItem(id, duration, overrides = {}) {
1413
1413
  // src/server/mocks/transport.ts
1414
1414
  import { vi as vi6 } from "vitest";
1415
1415
  var MockTransport = class {
1416
- constructor() {
1417
- this.address = "127.0.0.1";
1418
- this.port = 27910;
1419
- this.sentMessages = [];
1420
- this.receivedMessages = [];
1416
+ onConnectionCallback;
1417
+ onErrorCallback;
1418
+ address = "127.0.0.1";
1419
+ port = 27910;
1420
+ sentMessages = [];
1421
+ receivedMessages = [];
1422
+ listening = false;
1423
+ listenSpy = legacyFn(async (port) => {
1424
+ this.port = port;
1425
+ this.listening = true;
1426
+ });
1427
+ closeSpy = legacyFn(() => {
1421
1428
  this.listening = false;
1422
- this.listenSpy = legacyFn(async (port) => {
1423
- this.port = port;
1424
- this.listening = true;
1425
- });
1426
- this.closeSpy = legacyFn(() => {
1427
- this.listening = false;
1428
- });
1429
- }
1429
+ });
1430
1430
  /**
1431
1431
  * Start listening on the specified port.
1432
1432
  */
@@ -1514,9 +1514,10 @@ function createMockNetDriver(overrides) {
1514
1514
  // src/server/mockTransport.ts
1515
1515
  import { NetChan } from "@quake2ts/shared";
1516
1516
  var MockNetworkTransport = class {
1517
+ netchan;
1518
+ recordedPackets = [];
1519
+ sentPackets = [];
1517
1520
  constructor() {
1518
- this.recordedPackets = [];
1519
- this.sentPackets = [];
1520
1521
  this.netchan = new NetChan();
1521
1522
  this.netchan.setup(1234, { type: "loopback", port: 0 });
1522
1523
  }
@@ -1552,25 +1553,23 @@ var MockNetworkTransport = class {
1552
1553
 
1553
1554
  // src/server/mockNetDriver.ts
1554
1555
  var MockNetDriver = class {
1555
- constructor() {
1556
- this.state = {
1557
- connected: false,
1558
- messagesSent: [],
1559
- messageHandlers: [],
1560
- closeHandlers: [],
1561
- errorHandlers: []
1562
- };
1563
- this.connectSpy = legacyFn(async (url) => {
1564
- this.state.connected = true;
1565
- });
1566
- this.disconnectSpy = legacyFn(() => {
1567
- this.state.connected = false;
1568
- this.state.closeHandlers.forEach((h) => h());
1569
- });
1570
- this.sendSpy = legacyFn((data) => {
1571
- this.state.messagesSent.push(new Uint8Array(data));
1572
- });
1573
- }
1556
+ state = {
1557
+ connected: false,
1558
+ messagesSent: [],
1559
+ messageHandlers: [],
1560
+ closeHandlers: [],
1561
+ errorHandlers: []
1562
+ };
1563
+ connectSpy = legacyFn(async (url) => {
1564
+ this.state.connected = true;
1565
+ });
1566
+ disconnectSpy = legacyFn(() => {
1567
+ this.state.connected = false;
1568
+ this.state.closeHandlers.forEach((h) => h());
1569
+ });
1570
+ sendSpy = legacyFn((data) => {
1571
+ this.state.messagesSent.push(new Uint8Array(data));
1572
+ });
1574
1573
  connect(url) {
1575
1574
  return this.connectSpy(url);
1576
1575
  }
@@ -2274,6 +2273,7 @@ function createMockWheelEvent(deltaX = 0, deltaY = 0) {
2274
2273
  });
2275
2274
  }
2276
2275
  var MockPointerLock = class {
2276
+ _doc;
2277
2277
  constructor(doc = document) {
2278
2278
  this._doc = doc;
2279
2279
  this.setup();
@@ -2410,196 +2410,66 @@ function createInputInjector(target) {
2410
2410
  // src/engine/mocks/webgl.ts
2411
2411
  import { vi as vi10 } from "vitest";
2412
2412
  var MockWebGL2RenderingContext = class {
2413
+ ARRAY_BUFFER = 34962;
2414
+ ELEMENT_ARRAY_BUFFER = 34963;
2415
+ STATIC_DRAW = 35044;
2416
+ DYNAMIC_DRAW = 35048;
2417
+ FLOAT = 5126;
2418
+ UNSIGNED_SHORT = 5123;
2419
+ TEXTURE_2D = 3553;
2420
+ TEXTURE_CUBE_MAP = 34067;
2421
+ TEXTURE_CUBE_MAP_POSITIVE_X = 34069;
2422
+ TEXTURE0 = 33984;
2423
+ TEXTURE_WRAP_S = 10242;
2424
+ TEXTURE_WRAP_T = 10243;
2425
+ TEXTURE_MIN_FILTER = 10241;
2426
+ TEXTURE_MAG_FILTER = 10240;
2427
+ LINEAR = 9729;
2428
+ NEAREST = 9728;
2429
+ CLAMP_TO_EDGE = 33071;
2430
+ RGBA = 6408;
2431
+ UNSIGNED_BYTE = 5121;
2432
+ FRAMEBUFFER = 36160;
2433
+ COLOR_ATTACHMENT0 = 36064;
2434
+ DEPTH_ATTACHMENT = 36096;
2435
+ RENDERBUFFER = 36161;
2436
+ DEPTH_COMPONENT24 = 33190;
2437
+ FRAMEBUFFER_COMPLETE = 36053;
2438
+ TRIANGLES = 4;
2439
+ DEPTH_TEST = 2929;
2440
+ CULL_FACE = 2884;
2441
+ BLEND = 3042;
2442
+ SRC_ALPHA = 770;
2443
+ ONE_MINUS_SRC_ALPHA = 771;
2444
+ ONE = 1;
2445
+ BACK = 1029;
2446
+ LEQUAL = 515;
2447
+ VERTEX_SHADER = 35633;
2448
+ FRAGMENT_SHADER = 35632;
2449
+ COMPILE_STATUS = 35713;
2450
+ LINK_STATUS = 35714;
2451
+ ONE_MINUS_SRC_COLOR = 769;
2452
+ TRIANGLE_STRIP = 5;
2453
+ QUERY_RESULT_AVAILABLE = 34919;
2454
+ QUERY_RESULT = 34918;
2455
+ // Constants commonly used in setup/webgl.ts
2456
+ TRIANGLE_FAN = 6;
2457
+ COLOR_BUFFER_BIT = 16384;
2458
+ DEPTH_BUFFER_BIT = 256;
2459
+ canvas;
2460
+ drawingBufferWidth;
2461
+ drawingBufferHeight;
2462
+ shaderCounter = 0;
2463
+ programCounter = 0;
2464
+ compileSucceeds = true;
2465
+ linkSucceeds = true;
2466
+ shaderInfoLog = "shader failed";
2467
+ programInfoLog = "program failed";
2468
+ extensions = /* @__PURE__ */ new Map();
2469
+ calls = [];
2470
+ uniformLocations = /* @__PURE__ */ new Map();
2471
+ attributeLocations = /* @__PURE__ */ new Map();
2413
2472
  constructor(canvas) {
2414
- this.ARRAY_BUFFER = 34962;
2415
- this.ELEMENT_ARRAY_BUFFER = 34963;
2416
- this.STATIC_DRAW = 35044;
2417
- this.DYNAMIC_DRAW = 35048;
2418
- this.FLOAT = 5126;
2419
- this.UNSIGNED_SHORT = 5123;
2420
- this.TEXTURE_2D = 3553;
2421
- this.TEXTURE_CUBE_MAP = 34067;
2422
- this.TEXTURE_CUBE_MAP_POSITIVE_X = 34069;
2423
- this.TEXTURE0 = 33984;
2424
- this.TEXTURE_WRAP_S = 10242;
2425
- this.TEXTURE_WRAP_T = 10243;
2426
- this.TEXTURE_MIN_FILTER = 10241;
2427
- this.TEXTURE_MAG_FILTER = 10240;
2428
- this.LINEAR = 9729;
2429
- this.NEAREST = 9728;
2430
- this.CLAMP_TO_EDGE = 33071;
2431
- this.RGBA = 6408;
2432
- this.UNSIGNED_BYTE = 5121;
2433
- this.FRAMEBUFFER = 36160;
2434
- this.COLOR_ATTACHMENT0 = 36064;
2435
- this.DEPTH_ATTACHMENT = 36096;
2436
- this.RENDERBUFFER = 36161;
2437
- this.DEPTH_COMPONENT24 = 33190;
2438
- this.FRAMEBUFFER_COMPLETE = 36053;
2439
- this.TRIANGLES = 4;
2440
- this.DEPTH_TEST = 2929;
2441
- this.CULL_FACE = 2884;
2442
- this.BLEND = 3042;
2443
- this.SRC_ALPHA = 770;
2444
- this.ONE_MINUS_SRC_ALPHA = 771;
2445
- this.ONE = 1;
2446
- this.BACK = 1029;
2447
- this.LEQUAL = 515;
2448
- this.VERTEX_SHADER = 35633;
2449
- this.FRAGMENT_SHADER = 35632;
2450
- this.COMPILE_STATUS = 35713;
2451
- this.LINK_STATUS = 35714;
2452
- this.ONE_MINUS_SRC_COLOR = 769;
2453
- this.TRIANGLE_STRIP = 5;
2454
- this.QUERY_RESULT_AVAILABLE = 34919;
2455
- this.QUERY_RESULT = 34918;
2456
- // Constants commonly used in setup/webgl.ts
2457
- this.TRIANGLE_FAN = 6;
2458
- this.COLOR_BUFFER_BIT = 16384;
2459
- this.DEPTH_BUFFER_BIT = 256;
2460
- this.shaderCounter = 0;
2461
- this.programCounter = 0;
2462
- this.compileSucceeds = true;
2463
- this.linkSucceeds = true;
2464
- this.shaderInfoLog = "shader failed";
2465
- this.programInfoLog = "program failed";
2466
- this.extensions = /* @__PURE__ */ new Map();
2467
- this.calls = [];
2468
- this.uniformLocations = /* @__PURE__ */ new Map();
2469
- this.attributeLocations = /* @__PURE__ */ new Map();
2470
- this.enable = vi10.fn((cap) => this.calls.push(`enable:${cap}`));
2471
- this.disable = vi10.fn((cap) => this.calls.push(`disable:${cap}`));
2472
- this.depthFunc = vi10.fn((func) => this.calls.push(`depthFunc:${func}`));
2473
- this.cullFace = vi10.fn((mode) => this.calls.push(`cullFace:${mode}`));
2474
- this.depthMask = vi10.fn((flag) => this.calls.push(`depthMask:${flag}`));
2475
- this.blendFuncSeparate = vi10.fn(
2476
- (srcRGB, dstRGB, srcAlpha, dstAlpha) => this.calls.push(`blendFuncSeparate:${srcRGB}:${dstRGB}:${srcAlpha}:${dstAlpha}`)
2477
- );
2478
- this.blendFunc = vi10.fn((sfactor, dfactor) => this.calls.push(`blendFunc:${sfactor}:${dfactor}`));
2479
- this.getExtension = vi10.fn((name) => this.extensions.get(name) ?? null);
2480
- this.viewport = vi10.fn((x, y, w, h) => this.calls.push(`viewport:${x}:${y}:${w}:${h}`));
2481
- this.clear = vi10.fn((mask) => this.calls.push(`clear:${mask}`));
2482
- this.clearColor = vi10.fn((r, g, b, a) => this.calls.push(`clearColor:${r}:${g}:${b}:${a}`));
2483
- this.createShader = vi10.fn((type) => ({ id: ++this.shaderCounter, type }));
2484
- this.shaderSource = vi10.fn((shader, source) => this.calls.push(`shaderSource:${shader.id}:${source}`));
2485
- this.compileShader = vi10.fn((shader) => this.calls.push(`compileShader:${shader.id}`));
2486
- this.getShaderParameter = vi10.fn(
2487
- (shader, pname) => pname === this.COMPILE_STATUS ? this.compileSucceeds : null
2488
- );
2489
- this.getShaderInfoLog = vi10.fn(() => this.compileSucceeds ? "" : this.shaderInfoLog);
2490
- this.deleteShader = vi10.fn((shader) => this.calls.push(`deleteShader:${shader.id}`));
2491
- this.createProgram = vi10.fn(() => ({ id: ++this.programCounter }));
2492
- this.attachShader = vi10.fn(
2493
- (program, shader) => this.calls.push(`attach:${program.id}:${shader.id}`)
2494
- );
2495
- this.bindAttribLocation = vi10.fn(
2496
- (program, index, name) => this.calls.push(`bindAttribLocation:${program.id}:${index}:${name}`)
2497
- );
2498
- this.linkProgram = vi10.fn((program) => this.calls.push(`link:${program.id}`));
2499
- this.getProgramParameter = vi10.fn(
2500
- (program, pname) => pname === this.LINK_STATUS ? this.linkSucceeds : null
2501
- );
2502
- this.getProgramInfoLog = vi10.fn(() => this.linkSucceeds ? "" : this.programInfoLog);
2503
- this.deleteProgram = vi10.fn((program) => this.calls.push(`deleteProgram:${program.id}`));
2504
- this.useProgram = vi10.fn((program) => this.calls.push(`useProgram:${program?.id ?? "null"}`));
2505
- this.getUniformLocation = vi10.fn((program, name) => {
2506
- this.calls.push(`getUniformLocation:${program.id}:${name}`);
2507
- return this.uniformLocations.get(name) ?? null;
2508
- });
2509
- this.getAttribLocation = vi10.fn((program, name) => {
2510
- this.calls.push(`getAttribLocation:${program.id}:${name}`);
2511
- return this.attributeLocations.get(name) ?? -1;
2512
- });
2513
- this.createBuffer = vi10.fn(() => ({ buffer: {} }));
2514
- this.bindBuffer = vi10.fn((target, buffer) => this.calls.push(`bindBuffer:${target}:${!!buffer}`));
2515
- this.bufferData = vi10.fn(
2516
- (target, data, usage) => this.calls.push(`bufferData:${target}:${usage}:${typeof data === "number" ? data : "data"}`)
2517
- );
2518
- this.bufferSubData = vi10.fn(
2519
- (target, offset, data) => this.calls.push(`bufferSubData:${target}:${offset}:${data.byteLength ?? "len"}`)
2520
- );
2521
- this.deleteBuffer = vi10.fn((buffer) => this.calls.push(`deleteBuffer:${!!buffer}`));
2522
- this.createVertexArray = vi10.fn(() => ({ vao: {} }));
2523
- this.bindVertexArray = vi10.fn((vao) => this.calls.push(`bindVertexArray:${!!vao}`));
2524
- this.enableVertexAttribArray = vi10.fn((index) => this.calls.push(`enableAttrib:${index}`));
2525
- this.vertexAttribPointer = vi10.fn(
2526
- (index, size, type, normalized, stride, offset) => this.calls.push(`vertexAttribPointer:${index}:${size}:${type}:${normalized}:${stride}:${offset}`)
2527
- );
2528
- this.vertexAttribDivisor = vi10.fn((index, divisor) => this.calls.push(`divisor:${index}:${divisor}`));
2529
- this.deleteVertexArray = vi10.fn((vao) => this.calls.push(`deleteVertexArray:${!!vao}`));
2530
- this.createTexture = vi10.fn(() => ({ texture: {} }));
2531
- this.activeTexture = vi10.fn((unit) => this.calls.push(`activeTexture:${unit}`));
2532
- this.bindTexture = vi10.fn((target, texture) => this.calls.push(`bindTexture:${target}:${!!texture}`));
2533
- this.texParameteri = vi10.fn(
2534
- (target, pname, param) => this.calls.push(`texParameteri:${target}:${pname}:${param}`)
2535
- );
2536
- this.texImage2D = vi10.fn(
2537
- (target, level, internalFormat, width, height, border, format, type, pixels) => this.calls.push(
2538
- `texImage2D:${target}:${level}:${internalFormat}:${width}:${height}:${border}:${format}:${type}:${pixels ? "data" : "null"}`
2539
- )
2540
- );
2541
- // Explicitly typing this one with legacyFn or manually typing it to avoid inference errors
2542
- this.texImage3D = legacyFn();
2543
- this.deleteTexture = vi10.fn((texture) => this.calls.push(`deleteTexture:${!!texture}`));
2544
- this.createFramebuffer = vi10.fn(() => ({ fb: {} }));
2545
- this.bindFramebuffer = vi10.fn(
2546
- (target, framebuffer) => this.calls.push(`bindFramebuffer:${target}:${!!framebuffer}`)
2547
- );
2548
- this.framebufferTexture2D = vi10.fn(
2549
- (target, attachment, textarget, texture, level) => this.calls.push(`framebufferTexture2D:${target}:${attachment}:${textarget}:${!!texture}:${level}`)
2550
- );
2551
- this.deleteFramebuffer = vi10.fn((fb) => this.calls.push(`deleteFramebuffer:${!!fb}`));
2552
- this.checkFramebufferStatus = vi10.fn((target) => this.FRAMEBUFFER_COMPLETE);
2553
- this.createRenderbuffer = vi10.fn(() => ({ rb: {} }));
2554
- this.bindRenderbuffer = vi10.fn(
2555
- (target, renderbuffer) => this.calls.push(`bindRenderbuffer:${target}:${!!renderbuffer}`)
2556
- );
2557
- this.renderbufferStorage = vi10.fn(
2558
- (target, internalformat, width, height) => this.calls.push(`renderbufferStorage:${target}:${internalformat}:${width}:${height}`)
2559
- );
2560
- this.framebufferRenderbuffer = vi10.fn(
2561
- (target, attachment, renderbuffertarget, renderbuffer) => this.calls.push(`framebufferRenderbuffer:${target}:${attachment}:${renderbuffertarget}:${!!renderbuffer}`)
2562
- );
2563
- this.deleteRenderbuffer = vi10.fn((rb) => this.calls.push(`deleteRenderbuffer:${!!rb}`));
2564
- this.drawArrays = vi10.fn(
2565
- (mode, first, count) => this.calls.push(`drawArrays:${mode}:${first}:${count}`)
2566
- );
2567
- this.drawElements = vi10.fn(
2568
- (mode, count, type, offset) => this.calls.push(`drawElements:${mode}:${count}:${type}:${offset}`)
2569
- );
2570
- // Queries
2571
- this.createQuery = vi10.fn(() => ({}));
2572
- this.beginQuery = legacyFn();
2573
- this.endQuery = legacyFn();
2574
- this.deleteQuery = legacyFn();
2575
- this.getQueryParameter = legacyFn();
2576
- this.getParameter = legacyFn();
2577
- this.uniform1f = vi10.fn(
2578
- (location, x) => this.calls.push(`uniform1f:${location ? "set" : "null"}:${x}`)
2579
- );
2580
- this.uniform1i = vi10.fn(
2581
- (location, x) => this.calls.push(`uniform1i:${location ? "set" : "null"}:${x}`)
2582
- );
2583
- this.uniform4f = vi10.fn(
2584
- (location, x, y, z, w) => this.calls.push(`uniform4f:${location ? "set" : "null"}:${x}:${y}:${z}:${w}`)
2585
- );
2586
- this.uniform3fv = vi10.fn(
2587
- (location, data) => this.calls.push(`uniform3fv:${location ? "set" : "null"}:${Array.from(data).join(",")}`)
2588
- );
2589
- this.uniform3f = vi10.fn(
2590
- (location, x, y, z) => this.calls.push(`uniform3f:${location ? "set" : "null"}:${x}:${y}:${z}`)
2591
- );
2592
- this.uniform2f = vi10.fn(
2593
- (location, x, y) => this.calls.push(`uniform2f:${location ? "set" : "null"}:${x}:${y}`)
2594
- );
2595
- this.uniform4fv = vi10.fn(
2596
- (location, data) => this.calls.push(`uniform4fv:${location ? "set" : "null"}:${Array.from(data).join(",")}`)
2597
- );
2598
- this.uniformMatrix4fv = vi10.fn(
2599
- (location, transpose, data) => this.calls.push(`uniformMatrix4fv:${location ? "set" : "null"}:${transpose}:${Array.from(data).join(",")}`)
2600
- );
2601
- this.uniformBlockBinding = legacyFn();
2602
- this.isContextLost = vi10.fn(() => false);
2603
2473
  if (canvas) {
2604
2474
  this.canvas = canvas;
2605
2475
  this.drawingBufferWidth = canvas.width;
@@ -2610,6 +2480,139 @@ var MockWebGL2RenderingContext = class {
2610
2480
  this.drawingBufferHeight = 600;
2611
2481
  }
2612
2482
  }
2483
+ enable = vi10.fn((cap) => this.calls.push(`enable:${cap}`));
2484
+ disable = vi10.fn((cap) => this.calls.push(`disable:${cap}`));
2485
+ depthFunc = vi10.fn((func) => this.calls.push(`depthFunc:${func}`));
2486
+ cullFace = vi10.fn((mode) => this.calls.push(`cullFace:${mode}`));
2487
+ depthMask = vi10.fn((flag) => this.calls.push(`depthMask:${flag}`));
2488
+ blendFuncSeparate = vi10.fn(
2489
+ (srcRGB, dstRGB, srcAlpha, dstAlpha) => this.calls.push(`blendFuncSeparate:${srcRGB}:${dstRGB}:${srcAlpha}:${dstAlpha}`)
2490
+ );
2491
+ blendFunc = vi10.fn((sfactor, dfactor) => this.calls.push(`blendFunc:${sfactor}:${dfactor}`));
2492
+ getExtension = vi10.fn((name) => this.extensions.get(name) ?? null);
2493
+ viewport = vi10.fn((x, y, w, h) => this.calls.push(`viewport:${x}:${y}:${w}:${h}`));
2494
+ clear = vi10.fn((mask) => this.calls.push(`clear:${mask}`));
2495
+ clearColor = vi10.fn((r, g, b, a) => this.calls.push(`clearColor:${r}:${g}:${b}:${a}`));
2496
+ createShader = vi10.fn((type) => ({ id: ++this.shaderCounter, type }));
2497
+ shaderSource = vi10.fn((shader, source) => this.calls.push(`shaderSource:${shader.id}:${source}`));
2498
+ compileShader = vi10.fn((shader) => this.calls.push(`compileShader:${shader.id}`));
2499
+ getShaderParameter = vi10.fn(
2500
+ (shader, pname) => pname === this.COMPILE_STATUS ? this.compileSucceeds : null
2501
+ );
2502
+ getShaderInfoLog = vi10.fn(() => this.compileSucceeds ? "" : this.shaderInfoLog);
2503
+ deleteShader = vi10.fn((shader) => this.calls.push(`deleteShader:${shader.id}`));
2504
+ createProgram = vi10.fn(() => ({ id: ++this.programCounter }));
2505
+ attachShader = vi10.fn(
2506
+ (program, shader) => this.calls.push(`attach:${program.id}:${shader.id}`)
2507
+ );
2508
+ bindAttribLocation = vi10.fn(
2509
+ (program, index, name) => this.calls.push(`bindAttribLocation:${program.id}:${index}:${name}`)
2510
+ );
2511
+ linkProgram = vi10.fn((program) => this.calls.push(`link:${program.id}`));
2512
+ getProgramParameter = vi10.fn(
2513
+ (program, pname) => pname === this.LINK_STATUS ? this.linkSucceeds : null
2514
+ );
2515
+ getProgramInfoLog = vi10.fn(() => this.linkSucceeds ? "" : this.programInfoLog);
2516
+ deleteProgram = vi10.fn((program) => this.calls.push(`deleteProgram:${program.id}`));
2517
+ useProgram = vi10.fn((program) => this.calls.push(`useProgram:${program?.id ?? "null"}`));
2518
+ getUniformLocation = vi10.fn((program, name) => {
2519
+ this.calls.push(`getUniformLocation:${program.id}:${name}`);
2520
+ return this.uniformLocations.get(name) ?? null;
2521
+ });
2522
+ getAttribLocation = vi10.fn((program, name) => {
2523
+ this.calls.push(`getAttribLocation:${program.id}:${name}`);
2524
+ return this.attributeLocations.get(name) ?? -1;
2525
+ });
2526
+ createBuffer = vi10.fn(() => ({ buffer: {} }));
2527
+ bindBuffer = vi10.fn((target, buffer) => this.calls.push(`bindBuffer:${target}:${!!buffer}`));
2528
+ bufferData = vi10.fn(
2529
+ (target, data, usage) => this.calls.push(`bufferData:${target}:${usage}:${typeof data === "number" ? data : "data"}`)
2530
+ );
2531
+ bufferSubData = vi10.fn(
2532
+ (target, offset, data) => this.calls.push(`bufferSubData:${target}:${offset}:${data.byteLength ?? "len"}`)
2533
+ );
2534
+ deleteBuffer = vi10.fn((buffer) => this.calls.push(`deleteBuffer:${!!buffer}`));
2535
+ createVertexArray = vi10.fn(() => ({ vao: {} }));
2536
+ bindVertexArray = vi10.fn((vao) => this.calls.push(`bindVertexArray:${!!vao}`));
2537
+ enableVertexAttribArray = vi10.fn((index) => this.calls.push(`enableAttrib:${index}`));
2538
+ vertexAttribPointer = vi10.fn(
2539
+ (index, size, type, normalized, stride, offset) => this.calls.push(`vertexAttribPointer:${index}:${size}:${type}:${normalized}:${stride}:${offset}`)
2540
+ );
2541
+ vertexAttribDivisor = vi10.fn((index, divisor) => this.calls.push(`divisor:${index}:${divisor}`));
2542
+ deleteVertexArray = vi10.fn((vao) => this.calls.push(`deleteVertexArray:${!!vao}`));
2543
+ createTexture = vi10.fn(() => ({ texture: {} }));
2544
+ activeTexture = vi10.fn((unit) => this.calls.push(`activeTexture:${unit}`));
2545
+ bindTexture = vi10.fn((target, texture) => this.calls.push(`bindTexture:${target}:${!!texture}`));
2546
+ texParameteri = vi10.fn(
2547
+ (target, pname, param) => this.calls.push(`texParameteri:${target}:${pname}:${param}`)
2548
+ );
2549
+ texImage2D = vi10.fn(
2550
+ (target, level, internalFormat, width, height, border, format, type, pixels) => this.calls.push(
2551
+ `texImage2D:${target}:${level}:${internalFormat}:${width}:${height}:${border}:${format}:${type}:${pixels ? "data" : "null"}`
2552
+ )
2553
+ );
2554
+ // Explicitly typing this one with legacyFn or manually typing it to avoid inference errors
2555
+ texImage3D = legacyFn();
2556
+ deleteTexture = vi10.fn((texture) => this.calls.push(`deleteTexture:${!!texture}`));
2557
+ createFramebuffer = vi10.fn(() => ({ fb: {} }));
2558
+ bindFramebuffer = vi10.fn(
2559
+ (target, framebuffer) => this.calls.push(`bindFramebuffer:${target}:${!!framebuffer}`)
2560
+ );
2561
+ framebufferTexture2D = vi10.fn(
2562
+ (target, attachment, textarget, texture, level) => this.calls.push(`framebufferTexture2D:${target}:${attachment}:${textarget}:${!!texture}:${level}`)
2563
+ );
2564
+ deleteFramebuffer = vi10.fn((fb) => this.calls.push(`deleteFramebuffer:${!!fb}`));
2565
+ checkFramebufferStatus = vi10.fn((target) => this.FRAMEBUFFER_COMPLETE);
2566
+ createRenderbuffer = vi10.fn(() => ({ rb: {} }));
2567
+ bindRenderbuffer = vi10.fn(
2568
+ (target, renderbuffer) => this.calls.push(`bindRenderbuffer:${target}:${!!renderbuffer}`)
2569
+ );
2570
+ renderbufferStorage = vi10.fn(
2571
+ (target, internalformat, width, height) => this.calls.push(`renderbufferStorage:${target}:${internalformat}:${width}:${height}`)
2572
+ );
2573
+ framebufferRenderbuffer = vi10.fn(
2574
+ (target, attachment, renderbuffertarget, renderbuffer) => this.calls.push(`framebufferRenderbuffer:${target}:${attachment}:${renderbuffertarget}:${!!renderbuffer}`)
2575
+ );
2576
+ deleteRenderbuffer = vi10.fn((rb) => this.calls.push(`deleteRenderbuffer:${!!rb}`));
2577
+ drawArrays = vi10.fn(
2578
+ (mode, first, count) => this.calls.push(`drawArrays:${mode}:${first}:${count}`)
2579
+ );
2580
+ drawElements = vi10.fn(
2581
+ (mode, count, type, offset) => this.calls.push(`drawElements:${mode}:${count}:${type}:${offset}`)
2582
+ );
2583
+ // Queries
2584
+ createQuery = vi10.fn(() => ({}));
2585
+ beginQuery = legacyFn();
2586
+ endQuery = legacyFn();
2587
+ deleteQuery = legacyFn();
2588
+ getQueryParameter = legacyFn();
2589
+ getParameter = legacyFn();
2590
+ uniform1f = vi10.fn(
2591
+ (location, x) => this.calls.push(`uniform1f:${location ? "set" : "null"}:${x}`)
2592
+ );
2593
+ uniform1i = vi10.fn(
2594
+ (location, x) => this.calls.push(`uniform1i:${location ? "set" : "null"}:${x}`)
2595
+ );
2596
+ uniform4f = vi10.fn(
2597
+ (location, x, y, z, w) => this.calls.push(`uniform4f:${location ? "set" : "null"}:${x}:${y}:${z}:${w}`)
2598
+ );
2599
+ uniform3fv = vi10.fn(
2600
+ (location, data) => this.calls.push(`uniform3fv:${location ? "set" : "null"}:${Array.from(data).join(",")}`)
2601
+ );
2602
+ uniform3f = vi10.fn(
2603
+ (location, x, y, z) => this.calls.push(`uniform3f:${location ? "set" : "null"}:${x}:${y}:${z}`)
2604
+ );
2605
+ uniform2f = vi10.fn(
2606
+ (location, x, y) => this.calls.push(`uniform2f:${location ? "set" : "null"}:${x}:${y}`)
2607
+ );
2608
+ uniform4fv = vi10.fn(
2609
+ (location, data) => this.calls.push(`uniform4fv:${location ? "set" : "null"}:${Array.from(data).join(",")}`)
2610
+ );
2611
+ uniformMatrix4fv = vi10.fn(
2612
+ (location, transpose, data) => this.calls.push(`uniformMatrix4fv:${location ? "set" : "null"}:${transpose}:${Array.from(data).join(",")}`)
2613
+ );
2614
+ uniformBlockBinding = legacyFn();
2615
+ isContextLost = vi10.fn(() => false);
2613
2616
  };
2614
2617
  function createMockWebGL2Context(overridesOrCanvas) {
2615
2618
  let context;
@@ -3376,43 +3379,35 @@ var FakeAudioParam = class {
3376
3379
  }
3377
3380
  };
3378
3381
  var FakeAudioNode = class {
3379
- constructor() {
3380
- this.connections = [];
3381
- }
3382
+ connections = [];
3382
3383
  connect(destination) {
3383
3384
  this.connections.push(destination);
3384
3385
  }
3385
3386
  };
3386
3387
  var FakeGainNode = class extends FakeAudioNode {
3387
- constructor() {
3388
- super(...arguments);
3389
- this.gain = new FakeAudioParam(1);
3390
- }
3388
+ gain = new FakeAudioParam(1);
3391
3389
  };
3392
3390
  var FakePannerNode = class extends FakeAudioNode {
3393
- constructor() {
3394
- super(...arguments);
3395
- this.positionX = new FakeAudioParam(0);
3396
- this.positionY = new FakeAudioParam(0);
3397
- this.positionZ = new FakeAudioParam(0);
3398
- }
3391
+ positionX = new FakeAudioParam(0);
3392
+ positionY = new FakeAudioParam(0);
3393
+ positionZ = new FakeAudioParam(0);
3394
+ refDistance;
3395
+ maxDistance;
3396
+ rolloffFactor;
3397
+ distanceModel;
3399
3398
  };
3400
3399
  var FakeBiquadFilterNode = class extends FakeAudioNode {
3401
- constructor() {
3402
- super(...arguments);
3403
- this.frequency = new FakeAudioParam(0);
3404
- this.Q = new FakeAudioParam(0);
3405
- this.type = "lowpass";
3406
- }
3400
+ frequency = new FakeAudioParam(0);
3401
+ Q = new FakeAudioParam(0);
3402
+ type = "lowpass";
3407
3403
  };
3408
3404
  var FakeBufferSource = class extends FakeAudioNode {
3409
- constructor() {
3410
- super(...arguments);
3411
- this.buffer = null;
3412
- this.loop = false;
3413
- this.playbackRate = new FakeAudioParam(1);
3414
- this.onended = null;
3415
- }
3405
+ buffer = null;
3406
+ loop = false;
3407
+ playbackRate = new FakeAudioParam(1);
3408
+ onended = null;
3409
+ startedAt;
3410
+ stoppedAt;
3416
3411
  start(when = 0, offset, duration) {
3417
3412
  this.startedAt = when;
3418
3413
  this.offset = offset;
@@ -3422,19 +3417,23 @@ var FakeBufferSource = class extends FakeAudioNode {
3422
3417
  this.stoppedAt = when;
3423
3418
  this.onended?.();
3424
3419
  }
3420
+ offset;
3421
+ duration;
3425
3422
  };
3426
3423
  var FakeDestination = class extends FakeAudioNode {
3427
3424
  };
3428
3425
  var FakeAudioContext = class {
3426
+ destination = new FakeDestination();
3427
+ state = "suspended";
3428
+ currentTime = 0;
3429
+ resumeCalls = 0;
3430
+ gains = [];
3431
+ sources = [];
3432
+ panners = [];
3433
+ filters = [];
3434
+ lastDecoded;
3435
+ createPanner;
3429
3436
  constructor(enablePanner = true) {
3430
- this.destination = new FakeDestination();
3431
- this.state = "suspended";
3432
- this.currentTime = 0;
3433
- this.resumeCalls = 0;
3434
- this.gains = [];
3435
- this.sources = [];
3436
- this.panners = [];
3437
- this.filters = [];
3438
3437
  if (enablePanner) {
3439
3438
  this.createPanner = () => {
3440
3439
  const node = new FakePannerNode();
@@ -4035,26 +4034,24 @@ function createStorageTestScenario(storageType = "local") {
4035
4034
  // src/setup/audio.ts
4036
4035
  function setupMockAudioContext() {
4037
4036
  class MockAudioContext {
4038
- constructor() {
4039
- this.state = "suspended";
4040
- this.destination = {};
4041
- this.currentTime = 0;
4042
- this.listener = {
4043
- positionX: { value: 0 },
4044
- positionY: { value: 0 },
4045
- positionZ: { value: 0 },
4046
- forwardX: { value: 0 },
4047
- forwardY: { value: 0 },
4048
- forwardZ: { value: 0 },
4049
- upX: { value: 0 },
4050
- upY: { value: 0 },
4051
- upZ: { value: 0 },
4052
- setOrientation: () => {
4053
- },
4054
- setPosition: () => {
4055
- }
4056
- };
4057
- }
4037
+ state = "suspended";
4038
+ destination = {};
4039
+ currentTime = 0;
4040
+ listener = {
4041
+ positionX: { value: 0 },
4042
+ positionY: { value: 0 },
4043
+ positionZ: { value: 0 },
4044
+ forwardX: { value: 0 },
4045
+ forwardY: { value: 0 },
4046
+ forwardZ: { value: 0 },
4047
+ upX: { value: 0 },
4048
+ upY: { value: 0 },
4049
+ upZ: { value: 0 },
4050
+ setOrientation: () => {
4051
+ },
4052
+ setPosition: () => {
4053
+ }
4054
+ };
4058
4055
  createGain() {
4059
4056
  return {
4060
4057
  gain: { value: 1, linearRampToValueAtTime: () => {
@@ -5855,11 +5852,11 @@ var MAX_MODELS = 256;
5855
5852
  var MAX_SOUNDS = 256;
5856
5853
  var MAX_IMAGES = 256;
5857
5854
  var MockClientConfigStrings = class {
5855
+ strings = /* @__PURE__ */ new Map();
5856
+ models = [];
5857
+ sounds = [];
5858
+ images = [];
5858
5859
  constructor() {
5859
- this.strings = /* @__PURE__ */ new Map();
5860
- this.models = [];
5861
- this.sounds = [];
5862
- this.images = [];
5863
5860
  }
5864
5861
  set(index, value) {
5865
5862
  this.strings.set(index, value);