'use strict'; const test = require('node:test'); const assert = require('node:assert/strict'); const path = require('node:path'); const { resolveAppAssetPath } = require('../src/app-protocol'); const staticDir = path.join(__dirname, '..', 'static'); test('app protocol resolves only explicitly packaged renderer assets', () => { assert.equal(resolveAppAssetPath('app://bundle/index.html', staticDir), path.join(staticDir, 'index.html')); assert.equal(resolveAppAssetPath('app://bundle/styles.css?v=12', staticDir), path.join(staticDir, 'styles.css')); assert.equal(resolveAppAssetPath('app://bundle/alta-mark.png', staticDir), path.join(staticDir, 'alta-mark.png')); assert.equal(resolveAppAssetPath('app://other/index.html', staticDir), null); assert.equal(resolveAppAssetPath('app://bundle/../main.js', staticDir), null); assert.equal(resolveAppAssetPath('app://bundle/%2e%2e/main.js', staticDir), null); assert.equal(resolveAppAssetPath('file:///etc/passwd', staticDir), null); assert.equal(resolveAppAssetPath('app://bundle/not-packaged.js', staticDir), null); });