Files
gods-eye-view/src/layers/wildlifeSightings/acartiaTaxa.test.mjs
T
Yehe LiuandClaude Opus 5.5 14f88b3e08 feat: Wildlife Sightings layer from iNaturalist and Acartia
Recent community wildlife observations, as a new Wildlife group in the
layer panel.

- Server: keyless iNaturalist proxy (v2 observations with only the
  projected fields; undocumented v1 UTFGrid density tiles, decoded on the
  server) sharing one paced queue (burst 4, ~1/s, 60/min, 8,000/day budget,
  up to four in flight), in-memory caches and upstream-only cooldowns;
  Acartia Salish Sea marine-mammal feed rounded to 0.01 degrees with
  comments dropped.
- Layer: grid counts drawn as a soft view-ranked density glow; real sampled
  sightings as taxon badges at their true positions with ambient photo
  thumbnails and labels; obscured records stay privacy cells; a clicked
  sighting stays pinned through camera moves and refreshes.
- Anchored photo card per selection with the single iNaturalist link;
  attribution in the layer row and the Data attribution popover.
- Filters (CONFIRMED, taxa presets) round-trip in share links with token 9.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-05 16:17:12 -05:00

38 lines
1.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import test from 'node:test';
import assert from 'node:assert/strict';
import { ACARTIA_CETACEAN_NAMES, acartiaSpeciesGroup } from './acartiaTaxa.js';
test('frozen cetacean names accept only normalized exact species or aliases', () => {
assert.equal(Object.isFrozen(ACARTIA_CETACEAN_NAMES), true);
assert.throws(() => ACARTIA_CETACEAN_NAMES.push('Whale shark'), TypeError);
for (const name of ACARTIA_CETACEAN_NAMES) {
assert.equal(acartiaSpeciesGroup(name), 'cetacean');
assert.equal(acartiaSpeciesGroup(` ${name.toUpperCase()} `), 'cetacean');
assert.equal(acartiaSpeciesGroup(`${name} or another animal`), null);
}
assert.equal(acartiaSpeciesGroup('Dall’s porpoise'), 'cetacean');
assert.equal(acartiaSpeciesGroup('Pacific white–sided dolphin'), 'cetacean');
assert.equal(acartiaSpeciesGroup(' HARBOR PORPOISE '), 'cetacean');
});
test('clearly marine mammal names remain distinct from validated cetacean species', () => {
for (const name of [
'Harbor seal',
'Phoca vitulina',
'Sea otter',
'Unidentified whale',
]) {
assert.equal(acartiaSpeciesGroup(name), 'marine-mammal');
}
for (const name of [
'Unknown',
'Whale shark',
'Elephant',
'',
null,
{ species: 'Orca' },
]) {
assert.equal(acartiaSpeciesGroup(name), null);
}
});