Skip to content

armgit / Pake

Public Imported from GitHub
0

Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.

836 B
Raw Blame
import fs from 'node:fs';
import path from 'node:path';
import { describe, expect, it } from 'vitest';

const { user_agent: userAgent } = JSON.parse(
  fs.readFileSync(path.join(process.cwd(), 'src-tauri', 'pake.json'), 'utf8'),
);

describe('default user agents', () => {
  it.each(['macos', 'linux'])(
    '%s uses a fresh WebKit user agent so WebKit/WebKitGTK sites keep captions (#1406)',
    (os) => {
      expect(userAgent[os]).toMatch(
        /AppleWebKit\/605\.1\.15 .*Version\/27\.0 Safari\/605\.1\.15$/,
      );
      expect(userAgent[os]).not.toContain('Chrome/');
    },
  );

  it('windows uses a fresh desktop Chrome user agent without wrapper tokens', () => {
    expect(userAgent.windows).toMatch(/Chrome\/158\.0\.0\.0 Safari\/537\.36$/);
    expect(userAgent.windows).not.toMatch(/Edg\/|Tauri|Electron/i);
  });
});