File size: 775 Bytes
7c5ed63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { describe, it, expect } from 'vitest';
import { revealCommandFor } from '../../src/lib/reveal';

describe('reveal', () => {
  it('uses `open` on macOS', () => {
    expect(revealCommandFor('/tmp/x', 'darwin')).toEqual({
      command: 'open',
      args: ['/tmp/x'],
    });
  });

  it('uses cmd /c start on Windows', () => {
    expect(revealCommandFor('C:\\x', 'win32')).toEqual({
      command: 'cmd',
      args: ['/c', 'start', '""', 'C:\\x'],
    });
  });

  it('uses xdg-open on Linux and other unixes', () => {
    expect(revealCommandFor('/tmp/x', 'linux')).toEqual({
      command: 'xdg-open',
      args: ['/tmp/x'],
    });
    expect(revealCommandFor('/tmp/x', 'freebsd')).toEqual({
      command: 'xdg-open',
      args: ['/tmp/x'],
    });
  });
});