| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- import { describe, it, expect } from 'vitest';
- import { getCurrencySymbol, SUPPORTED_CURRENCIES } from '../../utils/currency';
- describe('getCurrencySymbol', () => {
- it('returns $ for USD', () => {
- expect(getCurrencySymbol('USD')).toBe('$');
- });
- it('returns € for EUR', () => {
- expect(getCurrencySymbol('EUR')).toBe('€');
- });
- it('returns £ for GBP', () => {
- expect(getCurrencySymbol('GBP')).toBe('£');
- });
- it('returns ₹ for INR', () => {
- expect(getCurrencySymbol('INR')).toBe('₹');
- });
- it('returns HK$ for HKD', () => {
- expect(getCurrencySymbol('HKD')).toBe('HK$');
- });
- it('returns RM for MYR', () => {
- expect(getCurrencySymbol('MYR')).toBe('RM');
- });
- it('returns ₴ for UAH', () => {
- expect(getCurrencySymbol('UAH')).toBe('₴');
- });
- it('returns BZ$ for BZD', () => {
- expect(getCurrencySymbol('BZD')).toBe('BZ$');
- });
- it('returns ₱ for PHP', () => {
- expect(getCurrencySymbol('PHP')).toBe('₱');
- });
- it('returns E£ for EGP', () => {
- expect(getCurrencySymbol('EGP')).toBe('E£');
- });
- it('returns RD$ for DOP', () => {
- expect(getCurrencySymbol('DOP')).toBe('RD$');
- });
- it('returns the code itself for unknown currencies', () => {
- expect(getCurrencySymbol('XYZ')).toBe('XYZ');
- });
- it('is case-insensitive', () => {
- expect(getCurrencySymbol('usd')).toBe('$');
- expect(getCurrencySymbol('eur')).toBe('€');
- });
- });
- describe('SUPPORTED_CURRENCIES', () => {
- it('contains INR', () => {
- expect(SUPPORTED_CURRENCIES.find((c) => c.code === 'INR')).toBeDefined();
- });
- it('contains EGP', () => {
- expect(SUPPORTED_CURRENCIES.find((c) => c.code === 'EGP')).toBeDefined();
- });
- it('contains DOP', () => {
- expect(SUPPORTED_CURRENCIES.find((c) => c.code === 'DOP')).toEqual({ code: 'DOP', label: 'DOP (RD$)' });
- });
- it('contains MYR', () => {
- expect(SUPPORTED_CURRENCIES.find((c) => c.code === 'MYR')).toBeDefined();
- });
- it('contains BZD', () => {
- expect(SUPPORTED_CURRENCIES.find((c) => c.code === 'BZD')).toBeDefined();
- });
- it('contains IDR', () => {
- expect(SUPPORTED_CURRENCIES.find((c) => c.code === 'IDR')).toBeDefined();
- });
- it('contains PHP', () => {
- expect(SUPPORTED_CURRENCIES.find((c) => c.code === 'PHP')).toEqual({ code: 'PHP', label: 'PHP (₱)' });
- });
- it('has 34 entries', () => {
- expect(SUPPORTED_CURRENCIES).toHaveLength(34);
- });
- });
|