gitflarePublicPartly agent-ready40
neon-drift
Real-time multiplayer arcade racer on Cloudflare Workers and Durable Objects.
- LicenseApache-2.0
- LanguageJavaScript
- Last landed
3efe3daOct 23, 2026
Add the Apache-2.0 licence
3efe3daimport test from 'node:test';import { registerHooks } from 'node:module';import { pathToFileURL } from 'node:url';import { resolve as pres } from 'node:path';registerHooks({ resolve(spec, ctx, next) { if (spec.startsWith('/shared/')) return next(pathToFileURL(pres(import.meta.dirname, '../public' + spec)).href, ctx); return next(spec, ctx); } });import assert from 'node:assert/strict';test('net.join sends join on same socket; opts.watch sets field 5', async () => { const sent = []; class WS { constructor() { this.readyState = 1; WS.last = this; setTimeout(() => this.onopen && this.onopen(), 0); } close() { this.onclose && this.onclose(); } send(d) { sent.push(JSON.parse(d)); } } globalThis.WebSocket = WS; globalThis.location = { protocol: 'http:', host: 'x', search: '' }; const store = {}; globalThis.sessionStorage = { getItem: (k) => store[k] ?? null, setItem: (k, v) => { store[k] = v; } }; const { createNet } = await import('../public/net.js'); const net = createNet('ABC', '', {}, { watch: true }); await new Promise((r) => setTimeout(r, 10)); assert.equal(sent[0][4], 1); net.join('Zed'); assert.equal(sent[1][1], 'Zed'); assert.equal(sent[1][4], undefined); net.close(); setTimeout(() => process.exit(process.exitCode ?? 0), 50).unref();});