import { describe, expect, test } from 'vitest';
import { isProblem } from './problem.helper';

describe('problem helper', () => {
  describe('isProblem', () => {
    test('should return false if no object', () => {
      expect(isProblem(undefined)).toEqual(false);
    });
    test('should return false if object has no type', () => {
      expect(isProblem({ toto: 'coucou' })).toEqual(false);
    });
    test('should return false if object type does not include correct protocol', () => {
      expect(isProblem({ type: 'http://' })).toEqual(false);
    });
    test('should return false if object type does not include correct protocol', () => {
      expect(isProblem({ type: 'https://my-url.fr' })).toEqual(true);
    });
    test('should return true if object is a problem', () => {
      expect(isProblem({ type: 'https://problems.bms.live/toto' })).toEqual(
        true,
      );
    });
  });
});
