Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

850 B
Raw Blame
import { describe, expect, it } from 'vitest';
import { moveBeside } from './move-beside';

describe('moving an id beside another', () => {
  it('puts it on the side asked, whichever way it travels', () => {
    expect(moveBeside(['a', 'b', 'c'], 'c', 'a', 'before')).toEqual([
      'c',
      'a',
      'b',
    ]);
    expect(moveBeside(['a', 'b', 'c'], 'a', 'b', 'after')).toEqual([
      'b',
      'a',
      'c',
    ]);
    expect(moveBeside(['a', 'b', 'c'], 'a', 'c', 'before')).toEqual([
      'b',
      'a',
      'c',
    ]);
  });

  it('moves nothing onto itself or beside an id the order lacks', () => {
    expect(moveBeside(['a', 'b'], 'a', 'a', 'after')).toBeUndefined();
    expect(moveBeside(['a', 'b'], 'a', 'gone', 'after')).toBeUndefined();
    expect(moveBeside(['a', 'b'], 'gone', 'a', 'after')).toBeUndefined();
  });
});