Files
coolify/tests/Unit/CountryHelpersTest.php
T
Aditya Tripathi 872f8aafb8 feat(traffic): add live refresh, geo maps, and app overview widget
- Add live 24h polling toggle to server/application analytics views
- Add geo visualization (world map, country flags/names) for traffic
- Add dashboard nudge for servers eligible but not yet analytics-enabled
- Add lazy-loaded TrafficOverview widget to application General page
- Default-enable traffic analytics on new eligible server settings
- Rotate Caddy access logs via lumberjack roll options
- Add Traefik logrotate sidecar for copytruncate access-log rotation
2026-08-11 10:55:50 +00:00

43 lines
1.2 KiB
PHP

<?php
describe('countryFlagEmoji', function () {
it('returns the correct flag for a valid uppercase code', function () {
expect(countryFlagEmoji('US'))->toBe('🇺🇸');
});
it('is case-insensitive', function () {
expect(countryFlagEmoji('us'))->toBe('🇺🇸');
});
it('returns the globe fallback for invalid input', function (?string $input) {
expect(countryFlagEmoji($input))->toBe('🌐');
})->with([
'null' => [null],
'empty' => [''],
'three letters' => ['USA'],
'non-letters' => ['1!'],
'single letter' => ['U'],
]);
});
describe('countryName', function () {
it('returns the English region name for a valid uppercase code', function () {
expect(countryName('US'))->toBe('United States');
});
it('is case-insensitive', function () {
expect(countryName('us'))->toBe('United States');
});
it('returns Unknown for invalid input', function (?string $input) {
expect(countryName($input))->toBe('Unknown');
})->with([
'null' => [null],
'empty' => [''],
'unresolvable ZZ' => ['ZZ'],
'unresolvable XX' => ['XX'],
'three letters' => ['USA'],
'non-letters' => ['1!'],
]);
});