Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

fix(desktop): stub the build channel in the Linux session test (#3186)

Hampus5d0c9c7cbed1
diff --git a/fluxer_desktop/src/main/LinuxSession.test.mjs b/fluxer_desktop/src/main/LinuxSession.test.mjs
index 655ed8347..fc1800af3 100644
--- a/fluxer_desktop/src/main/LinuxSession.test.mjs
+++ b/fluxer_desktop/src/main/LinuxSession.test.mjs
@@ -5,7 +5,10 @@ import {describe, test} from 'node:test';
import {loadTsModule} from './fixtures/TsModuleLoader.mjs';
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', () => {
const exists = (paths) => (candidate) => paths.includes(candidate);
@@ -73,9 +76,13 @@ describe('getLinuxDesktopId', () => {
Object.defineProperty(process, 'platform', {...platform, value: 'linux'});
try {
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');
- 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');
} finally {
Object.defineProperty(process, 'platform', platform);