/**
 * Test suite for getSchema
 */
import getSchema from '../getSchema';

describe('getSchema', () => {
  it('should return a promise when called', () => {
    const result = getSchema('sms');
    expect(result instanceof Promise).toBe(true);
  });

  it('should return SMS schema when channel is "sms"', () => {
    const result = getSchema('sms');
    return result.then((module) => {
      expect(module).toBeDefined();
    });
  });

  it('should return SMS schema when channel is "SMS" (uppercase)', () => {
    const result = getSchema('SMS');
    return result.then((module) => {
      expect(module).toBeDefined();
    });
  });

  it('should return EMAIL schema when channel is "email"', () => {
    const result = getSchema('email');
    return result.then((module) => {
      expect(module).toBeDefined();
    });
  });

  it('should return EMAIL schema when channel is "EMAIL" (uppercase)', () => {
    const result = getSchema('EMAIL');
    return result.then((module) => {
      expect(module).toBeDefined();
    });
  });

  it('should return MOBILE_PUSH schema when channel is "mobile_push"', () => {
    const result = getSchema('mobile_push');
    return result.then((module) => {
      expect(module).toBeDefined();
    });
  });

  it('should return MOBILE_PUSH schema when channel is "MOBILE_PUSH" (uppercase)', () => {
    const result = getSchema('MOBILE_PUSH');
    return result.then((module) => {
      expect(module).toBeDefined();
    });
  });

  it('should return WECHAT schema when channel is "wechat"', () => {
    const result = getSchema('wechat');
    return result.then((module) => {
      expect(module).toBeDefined();
    });
  });

  it('should return WECHAT schema when channel is "WECHAT" (uppercase)', () => {
    const result = getSchema('WECHAT');
    return result.then((module) => {
      expect(module).toBeDefined();
    });
  });

  it('should return SMS schema (default) when channel is unknown', () => {
    const result = getSchema('unknown_channel');
    return result.then((module) => {
      expect(module).toBeDefined();
    });
  });

  it('should return SMS schema (default) when channel is "whatsapp"', () => {
    const result = getSchema('whatsapp');
    return result.then((module) => {
      expect(module).toBeDefined();
    });
  });

  it('should handle mixed case channel names', () => {
    const result = getSchema('SmS');
    return result.then((module) => {
      expect(module).toBeDefined();
    });
  });

  it('should handle whitespace in channel names', () => {
    const result = getSchema(' sms ');
    return result.then((module) => {
      expect(module).toBeDefined();
    });
  });
});
