mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-29 11:42:04 +00:00
Bring apps/desktop and ui-tui to a clean state for typecheck, eslint,
and prettier:
- Run prettier across both trees (printWidth/wrap drift; prettier is not
CI-enforced for these JS projects, so main had accumulated drift).
- Apply eslint --fix for padding-line-between-statements and perfectionist
import/export sorting.
- Manual fixes for non-auto-fixable rules:
- remove unused node:net import in electron/main.cjs (uses Electron net)
- replace inline `typeof import(...)` annotations with top-level
`import type * as EnvModule` in two ui-tui test files
- scoped eslint-disable no-control-regex on intentional sentinel/ANSI
regexes (mathUnicode.ts, text.ts)
- resolve react-hooks/exhaustive-deps per-case: correct swapped/missing
deps, collapse redundant session.* members, and justified disables on
settings mount-only data-load effects to preserve run-once behavior
No behavior changes; test pass/fail counts are unchanged from the main
baseline.
37 lines
1 KiB
JavaScript
37 lines
1 KiB
JavaScript
/**
|
|
* Tests for OAuth-session Electron net.request helpers.
|
|
*
|
|
* Run with: node --test electron/oauth-net-request.test.cjs
|
|
*/
|
|
|
|
const test = require('node:test')
|
|
const assert = require('node:assert/strict')
|
|
|
|
const { serializeJsonBody, setJsonRequestHeaders } = require('./oauth-net-request.cjs')
|
|
|
|
test('serializeJsonBody returns undefined for absent bodies', () => {
|
|
assert.equal(serializeJsonBody(undefined), undefined)
|
|
})
|
|
|
|
test('serializeJsonBody JSON-encodes request bodies', () => {
|
|
const body = serializeJsonBody({ archived: true })
|
|
assert.ok(Buffer.isBuffer(body))
|
|
assert.equal(body.toString('utf8'), '{"archived":true}')
|
|
})
|
|
|
|
test('setJsonRequestHeaders does not set Electron-restricted Content-Length', () => {
|
|
const headers = []
|
|
const request = {
|
|
setHeader(name, value) {
|
|
headers.push([name, value])
|
|
}
|
|
}
|
|
|
|
setJsonRequestHeaders(request)
|
|
|
|
assert.deepEqual(headers, [['Content-Type', 'application/json']])
|
|
assert.equal(
|
|
headers.some(([name]) => name.toLowerCase() === 'content-length'),
|
|
false
|
|
)
|
|
})
|