Skip to content

gitflarePublicPartly agent-ready40

orbit-duel

Real-time two-player orbital combat game on Cloudflare Workers and Durable Objects.

main
Add the Apache-2.0 licence0413e56
JavaScript11 lines709 B
import test from 'node:test';import assert from 'node:assert/strict';import { feedIcon, deathText, podium, colorFor, FEED_MAX } from '../public/ui-helpers.js';test('feed icons', () => { assert.equal(feedIcon('kill'), '✕'); assert.equal(feedIcon('crash'), '☄'); assert.equal(FEED_MAX, 5); });test('death text', () => { assert.equal(deathText('Bob', 2.2), 'Destroyed by Bob — respawning in 3'); assert.match(deathText('', 0), /in 0$/); });test('podium top 3', () => {  const p = podium([[1, 'a', 1, 0, 0, 0], [2, 'b', 5, 0, 0, 0], [3, 'c', 3, 0, 0, 0], [4, 'd', 0, 0, 0, 0]]);  assert.deepEqual(p.map((r) => r[1]), ['b', 'c', 'a']);});test('colorFor', () => assert.match(colorFor(3), /^hsl\(/));