mirror of
https://github.com/tiennm99/vngeoguessr.git
synced 2026-10-11 03:13:56 +00:00
Below 3 points the result dialog says whether the guess had the right district or province, located server-side from the boundaries. The reveal links the spot on OpenStreetMap, and a Share button builds a squares line with the region's URL. Region pages and the root carry Open Graph metadata for link previews. An expired round is worded as expired rather than as a failed save. A skipped round gets a fresh session id so the unawaited delete cannot kill the next round. Below sm the theme switch collapses to one cycling button and the tally hides, so the mute control stays on a 360px screen. The panorama viewer loads on demand, taking three.js out of the first load.
16 lines
648 B
JavaScript
16 lines
648 B
JavaScript
import { describe, it, expect } from 'vitest';
|
|
import { buildShareText } from '../src/lib/share.js';
|
|
|
|
describe('buildShareText', () => {
|
|
it('draws the score as squares and links the region page', () => {
|
|
expect(buildShareText('Ha Noi', 4, '82m', 'https://example.test/game/hn')).toBe(
|
|
'VNGeoGuessr · Ha Noi\n🟩🟩🟩🟩⬜ 4/5 · 82m away\nhttps://example.test/game/hn'
|
|
);
|
|
});
|
|
|
|
it('clamps a score outside the ladder', () => {
|
|
expect(buildShareText('Vietnam', 9, '1.20km', 'u')).toContain('🟩🟩🟩🟩🟩 5/5');
|
|
expect(buildShareText('Vietnam', -1, '1.20km', 'u')).toContain('⬜⬜⬜⬜⬜ 0/5');
|
|
});
|
|
});
|