feat: generate and verify MSIX registry hives

Closes #3
This commit is contained in:
jychoi4 committed 2026-11-03 16:34:00 +09:00
1 parent 6213fec7d2
commit fdbc9a9d1b
7 files changed
+598 -2

No files matched your search

@@ -0,0 +1,24 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { newRegistryEntry, renderRegistryEditor } from '../src/registry-editor.ts';
test('new entries select the app view and preserve lossless text data', () => {
assert.equal(newRegistryEntry('x86', 'one').view, '32');
const entry = newRegistryEntry('x64', 'two');
entry.valueType = 'REG_QWORD'; entry.data = '18446744073709551615';
assert.match(renderRegistryEditor([entry], false), /18446744073709551615/);
assert.equal(JSON.parse(JSON.stringify(entry)).data, entry.data);
});
test('registry editor escapes markup and addresses rows after deletion', () => {
const first = newRegistryEntry('x64', 'first');
const second = newRegistryEntry('x64', 'second');
second.data = '</textarea><script>alert(1)</script>';
second.name = '" onfocus="bad';
const entries = [first, second]; entries.splice(0, 1);
const html = renderRegistryEditor(entries, true);
assert.ok(!html.includes('<script>'));
assert.ok(html.includes('&lt;/textarea&gt;'));
assert.ok(html.includes('&quot; onfocus=&quot;bad'));
assert.ok(html.includes('registry.0.data'));
assert.ok(html.includes('data-action="registry-remove:0" disabled'));
});