/* eslint-disable no-restricted-syntax */
import {
  capitalize,
  anchorLink,
  leftTrim,
  truncateString,
  getLaunchDate,
  getDate,
} from './strings';

describe('String helper component', () => {
  test('A letter to be uppercase', () => {
    expect(capitalize('capitalize')).toBe('Capitalize');
  });

  test("The whitespace from the link should be replaced with '-'", () => {
    expect(anchorLink('anchor tag')).toBe('anchor-tag');
  });
  test('If space on the left, trim the left, else trim multiple space in between', () => {
    expect(leftTrim(' trim left')).toBe('trim left');
    expect(leftTrim('trim multiple spaces')).toBe('trim multiple spaces');
  });
  test('Truncate the string based on the given number', () => {
    expect(truncateString('gzim', 2)).toBe('gz...');
  });
  test('If it is a space between the string cut it and truncate', () => {
    expect(truncateString('cut the string', 6)).toBe('cut...');
  });
  test('If the string is smaller than the number just return the string', () => {
    expect(truncateString('cut', 6)).toBe('cut');
  });
  test('Launch Date', () => {
    expect(getLaunchDate('2022-03-05')).toBe('2022');
  });

  test('Get date', () => {
    expect(getDate()).toBeTruthy();
  });
});
