import { isUK, isEUCountry, getCountryName } from '../shared/utils/countries'; // ------------------------------------------------------------------------- describe( 'isUK', () => { // Positive it( 'returns true for "GB"', () => { expect( isUK( 'GB' ) ).toBe( true ); } ); it( 'returns true for "UK"', () => { expect( isUK( 'UK' ) ).toBe( true ); } ); it( 'returns true for ISO3 "GBR"', () => { expect( isUK( 'GBR' ) ).toBe( true ); } ); it( 'is case-insensitive — accepts lowercase "gb"', () => { expect( isUK( 'gb' ) ).toBe( true ); } ); it( 'is case-insensitive — accepts mixed case "Gb"', () => { expect( isUK( 'Gb' ) ).toBe( true ); } ); // Negative it( 'returns false for "US"', () => { expect( isUK( 'US' ) ).toBe( false ); } ); it( 'returns false for "DE"', () => { expect( isUK( 'DE' ) ).toBe( false ); } ); it( 'returns false for empty string', () => { expect( isUK( '' ) ).toBe( false ); } ); it( 'returns false for a non-country string', () => { expect( isUK( 'NOTACOUNTRY' ) ).toBe( false ); } ); } ); // ------------------------------------------------------------------------- describe( 'isEUCountry', () => { // Positive it( 'returns true for "DE" (Germany)', () => { expect( isEUCountry( 'DE' ) ).toBe( true ); } ); it( 'returns true for ISO3 "DEU"', () => { expect( isEUCountry( 'DEU' ) ).toBe( true ); } ); it( 'returns true for "FR" (France)', () => { expect( isEUCountry( 'FR' ) ).toBe( true ); } ); it( 'accepts lowercase "de"', () => { expect( isEUCountry( 'de' ) ).toBe( true ); } ); it( 'returns true for "IE" (Ireland, EU member)', () => { expect( isEUCountry( 'IE' ) ).toBe( true ); } ); // Negative it( 'returns false for "GB" — not in EU post-Brexit', () => { expect( isEUCountry( 'GB' ) ).toBe( false ); } ); it( 'returns false for "US"', () => { expect( isEUCountry( 'US' ) ).toBe( false ); } ); it( 'returns false for empty string', () => { expect( isEUCountry( '' ) ).toBe( false ); } ); it( 'returns false for a made-up code', () => { expect( isEUCountry( 'XX' ) ).toBe( false ); } ); } ); // ------------------------------------------------------------------------- describe( 'getCountryName', () => { // Positive it( 'returns a non-empty name for "GB"', () => { const result = getCountryName( 'GB' ); expect( result.length ).toBeGreaterThan( 0 ); } ); it( 'returns a non-empty name for "US"', () => { const result = getCountryName( 'US' ); expect( result.length ).toBeGreaterThan( 0 ); } ); // Negative it( 'returns empty string for undefined', () => { expect( getCountryName( undefined ) ).toBe( '' ); } ); it( 'returns empty string for empty string', () => { expect( getCountryName( '' ) ).toBe( '' ); } ); it( 'returns the code itself for non-2-letter codes (ISO3)', () => { expect( getCountryName( 'GBR' ) ).toBe( 'GBR' ); } ); } );