Refractoring Stage 5 Moved the OpenPGP and DAV IPC handlers into desktop/ipc/pgp.cjs and desktop/ipc/dav.cjs.
This commit is contained in:
@@ -71,8 +71,14 @@ test('prevents renderer-supplied raw SMTP messages while accepting standard comp
|
||||
|
||||
test('every registered main-process IPC handler has a request schema', () => {
|
||||
const mainPath = path.resolve(__dirname, '..', 'desktop', 'main.cjs');
|
||||
const source = fs.readFileSync(mainPath, 'utf8');
|
||||
const channels = [...source.matchAll(/registerIpcHandler\('([^']+)'/g)].map(match => match[1]);
|
||||
const ipcDirectory = path.resolve(__dirname, '..', 'desktop', 'ipc');
|
||||
const sourceFiles = [mainPath, ...fs.readdirSync(ipcDirectory)
|
||||
.filter(name => name.endsWith('.cjs'))
|
||||
.map(name => path.join(ipcDirectory, name))];
|
||||
const channels = sourceFiles.flatMap(file => {
|
||||
const source = fs.readFileSync(file, 'utf8');
|
||||
return [...source.matchAll(/registerIpcHandler\('([^']+)'/g)].map(match => match[1]);
|
||||
});
|
||||
assert.ok(channels.length > 0);
|
||||
for (const channel of channels) {
|
||||
assert.equal(hasIpcSchema(channel), true, `missing IPC request schema: ${channel}`);
|
||||
|
||||
Reference in New Issue
Block a user