mirror of
https://gitlab.com/ArkHost/HelixNotes.git
synced 2026-09-19 09:27:29 +02:00
chore(release): prepare v1.3.5
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
|
||||
const source = await import(new URL('../src/lib/utils/notebook-icons.ts', import.meta.url));
|
||||
|
||||
const {
|
||||
NOTEBOOK_ICON_OPTIONS,
|
||||
decodeBuiltinNotebookIcon,
|
||||
encodeBuiltinNotebookIcon,
|
||||
normalizeNotebookIconKey
|
||||
} = source;
|
||||
|
||||
test('built-in notebook icons have stable unique storage values', () => {
|
||||
assert.equal(NOTEBOOK_ICON_OPTIONS.length, 16);
|
||||
assert.equal(new Set(NOTEBOOK_ICON_OPTIONS.map(({ id }) => id)).size, NOTEBOOK_ICON_OPTIONS.length);
|
||||
|
||||
for (const { id } of NOTEBOOK_ICON_OPTIONS) {
|
||||
const stored = encodeBuiltinNotebookIcon(id);
|
||||
assert.equal(stored, `builtin:${id}`);
|
||||
assert.equal(decodeBuiltinNotebookIcon(stored), id);
|
||||
}
|
||||
});
|
||||
|
||||
test('custom paths and unknown built-in values remain outside the icon codec', () => {
|
||||
assert.equal(decodeBuiltinNotebookIcon('.helixnotes/attachments/notebook-icon.png'), null);
|
||||
assert.equal(decodeBuiltinNotebookIcon('builtin:unknown'), null);
|
||||
assert.equal(decodeBuiltinNotebookIcon(null), null);
|
||||
});
|
||||
|
||||
test('normalizes notebook icon keys to portable vault-relative paths', () => {
|
||||
assert.equal(normalizeNotebookIconKey('Projects/Client'), 'Projects/Client');
|
||||
assert.equal(normalizeNotebookIconKey(String.raw`Projects\Client`), 'Projects/Client');
|
||||
});
|
||||
Reference in New Issue
Block a user