Skip to content

Commit

Permalink
tests: Add case for handling malformed overrides files
Browse files Browse the repository at this point in the history
Closes #558
  • Loading branch information
tchx84 committed Aug 31, 2023
1 parent 6ace81d commit 9e148b0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Context]
shared=network;
1 change: 1 addition & 0 deletions tests/content/user/flatpak/overrides/com.test.Malformed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
malformed
10 changes: 10 additions & 0 deletions tests/src/testModels.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const _resetModeId = 'com.test.ResetMode';
const _globalAppId = 'com.test.Global';
const _globalRestoredAppId = 'com.test.GlobalRestored';
const _statusesAppId = 'com.test.Statuses';
const _malformedAppId = 'com.test.Malformed';

const _flatpakInfo = GLib.build_filenamev(['..', 'tests', 'content', '.flatpak-info']);
const _flatpakInfoOld = GLib.build_filenamev(['..', 'tests', 'content', '.flatpak-info.old']);
Expand Down Expand Up @@ -1389,4 +1390,13 @@ describe('Model', function() {

update();
});

it('handles malformed overrides', function() {
spyOn(permissions, 'emit');

GLib.setenv('FLATPAK_USER_DIR', _user, true);
permissions.appId = _malformedAppId;

expect(permissions.emit.calls.first().args).toEqual(['failed']);
});
});

0 comments on commit 9e148b0

Please sign in to comment.