test: add unit tests for core modules (#35)
CI / check (pull_request) Failing after 1m39s

Cover high-priority untested modules:
- util: base32, result, refs-field, storage-root, log-tag
- util-agent: storage (normalizeWorkflowConfig, resolveStorageRoot), run (parseArgv)
- agent-builtin: tools (read-file, write-file, run-command), session, detail

627 → 719 tests (+92), all passing.

Refs #35
This commit is contained in:
2026-06-04 04:35:33 +00:00
parent c3ec4ac6df
commit 06e959e7a5
14 changed files with 873 additions and 0 deletions
@@ -0,0 +1,25 @@
import { describe, it, expect } from 'vitest';
import { homedir } from 'node:os';
import { getDefaultStorageRoot, getDefaultWorkflowStorageRoot, getGlobalCasDir } from '../src/storage-root.js';
describe('getDefaultStorageRoot', () => {
it('returns homedir + /.uwf', () => {
expect(getDefaultStorageRoot()).toBe(homedir() + '/.uwf');
});
});
describe('getDefaultWorkflowStorageRoot', () => {
it('returns same as getDefaultStorageRoot (deprecated alias)', () => {
expect(getDefaultWorkflowStorageRoot()).toBe(getDefaultStorageRoot());
});
});
describe('getGlobalCasDir', () => {
it('appends /cas to given storage root', () => {
expect(getGlobalCasDir('/tmp/test')).toBe('/tmp/test/cas');
});
it('falls back to default when undefined', () => {
expect(getGlobalCasDir(undefined)).toBe(homedir() + '/.uwf/cas');
});
});