Skip to content

Open-source and local-first Slack and Notion alternative that puts you in control of your data

602 B
Raw Blame
import { describe, expect, it } from 'vitest';

import { compareString, getNameFromEmail } from '@colanode/server/lib/utils';

describe('utils', () => {
  it('builds display names from email local parts', () => {
    expect(getNameFromEmail('[email protected]')).toBe('Jane Doe');
    expect(getNameFromEmail('[email protected]')).toBe(
      'John Doe Smith'
    );
  });

  it('compares strings with nulls and undefined', () => {
    expect(compareString('a', 'a')).toBe(0);
    expect(compareString(undefined, 'a')).toBe(-1);
    expect(compareString('a', undefined)).toBe(1);
  });
});