Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@ jobs:
matrix:
node-version:
- '22.11'
- '20.18'
- '18.20'
os:
- macos-latest
- ubuntu-latest
- windows-latest
runs-on: '${{ matrix.os }}'
steps:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@types/jest": "^29.5.14",
"@types/ms": "^0.7.31",
"@types/node": "^22.10.1",
"electron": "^39.8.4",
"electron": "^41.1.1",
"husky": "^9.1.7",
"jest": "^29.0.0",
"lint-staged": "^16.4.0",
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,10 @@ function initUpdater(opts: ReturnType<typeof validateInput>) {
let serverType: 'default' | 'json' = 'default';
switch (updateSource.type) {
case UpdateSourceType.ElectronPublicUpdateService: {
const formatSegment = process.windowsStore ? '/msix' : '';
feedURL = `${updateSource.host}/${updateSource.repo}/${process.platform}-${
process.arch
}/${app.getVersion()}`;
}${formatSegment}/${app.getVersion()}`;
break;
}
case UpdateSourceType.StaticStorage: {
Expand Down
32 changes: 32 additions & 0 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,38 @@ describe('updateElectronApp', () => {
});
});

describe('updateFormat', () => {
it('includes /msix/ in feed URL when process.windowsStore is true', () => {
const original = process.windowsStore;
Object.defineProperty(process, 'windowsStore', { value: true, configurable: true });
const logSpy = jest.spyOn(console, 'log');
updateElectronApp({
updateSource: {
type: UpdateSourceType.ElectronPublicUpdateService,
repo,
},
});
expect(logSpy).toHaveBeenCalledWith('feedURL', expect.stringContaining('/msix/'));
logSpy.mockRestore();
Object.defineProperty(process, 'windowsStore', { value: original, configurable: true });
});

it('omits format from feed URL when process.windowsStore is falsy', () => {
const original = process.windowsStore;
Object.defineProperty(process, 'windowsStore', { value: undefined, configurable: true });
const logSpy = jest.spyOn(console, 'log');
updateElectronApp({
updateSource: {
type: UpdateSourceType.ElectronPublicUpdateService,
repo,
},
});
expect(logSpy).toHaveBeenCalledWith('feedURL', expect.not.stringContaining('/msix/'));
logSpy.mockRestore();
Object.defineProperty(process, 'windowsStore', { value: original, configurable: true });
});
});

describe('updateInterval', () => {
it('must be 5 minutes or more', () => {
expect(() => {
Expand Down
Loading