Skip to content

A games launcher for GOG, Amazon and Epic Games for Linux, Windows and macOS.

1.4 KB
Raw Blame
import type { WineInstallation } from 'common/types'
import { isGptkRunner, selectSteamRuntimeRunner } from '../runtime_runner'

function wine(
  name: string,
  type: WineInstallation['type'],
  bin = `/wines/${name}/bin/wine`
): WineInstallation {
  return { name, type, bin }
}

describe('Steam runtime runner', () => {
  it('prefers a DXMT Wine over other builds', () => {
    const candidate = selectSteamRuntimeRunner([
      wine('Wine - 11.1', 'wine'),
      wine('Wine - 11.5-DXMT', 'wine'),
      wine('CrossOver - 26.3', 'crossover')
    ])
    expect(candidate?.name).toBe('Wine - 11.5-DXMT')
  })

  it('falls back to CrossOver when there is no DXMT build', () => {
    const candidate = selectSteamRuntimeRunner([
      wine('Wine - 11.5', 'wine'),
      wine('CrossOver - 26.3', 'crossover')
    ])
    expect(candidate?.name).toBe('CrossOver - 26.3')
  })

  it('never selects GPTK', () => {
    const candidate = selectSteamRuntimeRunner([
      wine('Game-Porting-Toolkit - 4.0', 'toolkit'),
      wine('Wine - 11.5', 'wine')
    ])
    expect(candidate?.name).toBe('Wine - 11.5')
    expect(
      selectSteamRuntimeRunner([wine('Game-Porting-Toolkit - 4.0', 'toolkit')])
    ).toBeUndefined()
  })

  it('recognises a GPTK runner path', () => {
    expect(
      isGptkRunner('/heroic/tools/game-porting-toolkit/GPTK-4.0/bin/wine')
    ).toBe(true)
    expect(isGptkRunner('/heroic/tools/wine/Wine-11.5-DXMT/bin/wine')).toBe(
      false
    )
  })
})