CH-J Server Managerquản lý máy chủ qua SSH
Menu
Mã nguồn đã công bố

CH-J Server Manager

Duyệt thư mục và tệp của một bản phát hành ứng dụng cụ thể.

Tải mã nguồn dạng ZIP
CH-J / Server Manager 368 tệp
core-20261017T201717Z-057348c4a70f Ngày thêm: Chưa ghi nhận ngày · Ngày dựng:
logService.test.js Ngày thêm: Chưa ghi nhận ngày 1,3 KB · 27 dòng
Mã Tải tệp xuống
1"use strict";
3const test = require("node:test");
4const assert = require("node:assert/strict");
5const fs = require("node:fs");
6const os = require("node:os");
7const path = require("node:path");
8const { LogService, MAX_LIMIT, normalizeLimit } = require("../src/main/logging/logService");
10test("log service returns a bounded tail without a partial first record", async (t) => {
11 const root = fs.mkdtempSync(path.join(os.tmpdir(), "chj-log-"));
12 t.after(() => fs.rmSync(root, { recursive: true, force: true }));
13 const logPath = path.join(root, "core.log");
14 fs.writeFileSync(logPath, "first-record\nsecond-record\nthird-record\n");
15 const result = await new LogService(logPath).readTail({ maxBytes: 29 });
16 assert.equal(result.text, "second-record\nthird-record\n");
17 assert.equal(result.truncated, true);
18 assert.equal(result.size, 40);
19 assert.match(result.readAt, /^\d{4}-\d{2}-\d{2}T/);
20});
22test("log service handles a missing log and caps read limits", async (t) => {
23 const root = fs.mkdtempSync(path.join(os.tmpdir(), "chj-log-missing-"));
24 t.after(() => fs.rmSync(root, { recursive: true, force: true }));
25 assert.equal(normalizeLimit(Number.MAX_SAFE_INTEGER), MAX_LIMIT);
26 assert.equal((await new LogService(path.join(root, "missing.log")).readTail()).text, "");
27});
SHA-25683099441b516dc585e5dbebf22dc6c8fa3df77e539538f2b8673e6869e7bf137

CH-J Proprietary Software License 1.14 · Mã nguồn được cung cấp theo CH-J Proprietary Software License 1.14. Việc công khai mã nguồn không thay đổi các điều khoản giấy phép và không cấp thêm quyền nào.

SHA-256 của tệp néncf4455b698f0f28e456a37b1834976a0194d8486acb7101052d59a838745cca3
Tệp