mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-07 19:22:14 +09:00
fix(desktop): stub the build channel in the Linux session test (#3186)
This commit is contained in:
@@ -5,7 +5,10 @@ import {describe, test} from 'node:test';
|
|||||||
import {loadTsModule} from './fixtures/TsModuleLoader.mjs';
|
import {loadTsModule} from './fixtures/TsModuleLoader.mjs';
|
||||||
|
|
||||||
const session = loadTsModule('@electron/main/LinuxSession', {stubs: {'node:fs': {existsSync: () => false}}});
|
const session = loadTsModule('@electron/main/LinuxSession', {stubs: {'node:fs': {existsSync: () => false}}});
|
||||||
const sandbox = loadTsModule('@electron/main/LinuxSandbox', {stubs: {'node:fs': {existsSync: () => false}}});
|
const BUILD_CHANNEL_STUB = {'@electron/common/BuildChannel': {BUILD_CHANNEL: 'stable'}};
|
||||||
|
const sandbox = loadTsModule('@electron/main/LinuxSandbox', {
|
||||||
|
stubs: {...BUILD_CHANNEL_STUB, 'node:fs': {existsSync: () => false}},
|
||||||
|
});
|
||||||
|
|
||||||
describe('detectLinuxSessionType', () => {
|
describe('detectLinuxSessionType', () => {
|
||||||
const exists = (paths) => (candidate) => paths.includes(candidate);
|
const exists = (paths) => (candidate) => paths.includes(candidate);
|
||||||
@@ -73,9 +76,13 @@ describe('getLinuxDesktopId', () => {
|
|||||||
Object.defineProperty(process, 'platform', {...platform, value: 'linux'});
|
Object.defineProperty(process, 'platform', {...platform, value: 'linux'});
|
||||||
try {
|
try {
|
||||||
process.env.FLATPAK_ID = 'app.fluxer.Fluxer';
|
process.env.FLATPAK_ID = 'app.fluxer.Fluxer';
|
||||||
const flatpak = loadTsModule('@electron/main/LinuxSandbox', {stubs: {'node:fs': {existsSync: () => true}}});
|
const flatpak = loadTsModule('@electron/main/LinuxSandbox', {
|
||||||
|
stubs: {...BUILD_CHANNEL_STUB, 'node:fs': {existsSync: () => true}},
|
||||||
|
});
|
||||||
assert.equal(flatpak.getLinuxDesktopId(), 'app.fluxer.Fluxer');
|
assert.equal(flatpak.getLinuxDesktopId(), 'app.fluxer.Fluxer');
|
||||||
const host = loadTsModule('@electron/main/LinuxSandbox', {stubs: {'node:fs': {existsSync: () => false}}});
|
const host = loadTsModule('@electron/main/LinuxSandbox', {
|
||||||
|
stubs: {...BUILD_CHANNEL_STUB, 'node:fs': {existsSync: () => false}},
|
||||||
|
});
|
||||||
assert.equal(host.getLinuxDesktopId(), 'app.fluxer.FluxerDesktop');
|
assert.equal(host.getLinuxDesktopId(), 'app.fluxer.FluxerDesktop');
|
||||||
} finally {
|
} finally {
|
||||||
Object.defineProperty(process, 'platform', platform);
|
Object.defineProperty(process, 'platform', platform);
|
||||||
|
|||||||
Reference in New Issue
Block a user