Refractoring Stage 6.2 Completed the first renderer modularization slice:
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const root = path.resolve(__dirname, '..');
|
||||
const read = file => fs.readFileSync(path.join(root, file), 'utf8');
|
||||
|
||||
test('renderer bootstrap loads shared state and mail security before the application', () => {
|
||||
const html = read('index.html');
|
||||
const state = html.indexOf('<script src="renderer-state.js"></script>');
|
||||
const contentSecurity = html.indexOf('<script src="mail-content-security.js"></script>');
|
||||
const app = html.indexOf('<script src="app.js"></script>');
|
||||
assert.ok(state >= 0 && contentSecurity > state && app > contentSecurity);
|
||||
});
|
||||
|
||||
test('desktop, Android web generation, and offline cache include renderer support modules', () => {
|
||||
const buildFiles = require(path.join(root, 'package.json')).build.files;
|
||||
const androidAssets = read('scripts/prepare-android-web.cjs');
|
||||
const worker = read('service-worker.js');
|
||||
for (const file of ['renderer-state.js', 'mail-content-security.js']) {
|
||||
assert.ok(buildFiles.includes(file), `Electron package is missing ${file}`);
|
||||
assert.ok(androidAssets.includes(`'${file}'`), `Android web generator is missing ${file}`);
|
||||
assert.ok(worker.includes(`'./${file}'`), `service worker is missing ${file}`);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user