SnowLuma v2.4.2 source snapshot
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
Publish MCP to npm / Build, test, and publish MCP (push) Waiting to run
Publish SDK to npm / Build, test, and publish SDK (push) Waiting to run
Sync action catalog to docs / sync (push) Waiting to run
Publish UI to npm / Build and publish UI (push) Waiting to run
Build and Release / preflight (push) Waiting to run
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
Publish MCP to npm / Build, test, and publish MCP (push) Waiting to run
Publish SDK to npm / Build, test, and publish SDK (push) Waiting to run
Sync action catalog to docs / sync (push) Waiting to run
Publish UI to npm / Build and publish UI (push) Waiting to run
Build and Release / preflight (push) Waiting to run
This commit is contained in:
commit
fa9c73363d
1367 files changed
+355735
No files matched your search
@@ -0,0 +1,32 @@
|
||||
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
||||
import fs from 'node:fs';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { listPerUinOneBotConfigFiles, readBackupConfigFile } from '../src/webui/server';
|
||||
|
||||
describe('backup filesystem adapter', () => {
|
||||
let root: string;
|
||||
|
||||
beforeEach(() => {
|
||||
root = fs.mkdtempSync(path.join(os.tmpdir(), 'snowluma-backup-http-'));
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
fs.rmSync(root, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
it('treats only a missing file as absent', () => {
|
||||
expect(readBackupConfigFile(root, 'missing.json')).toBeNull();
|
||||
|
||||
fs.mkdirSync(path.join(root, 'runtime.json'));
|
||||
expect(() => readBackupConfigFile(root, 'runtime.json')).toThrow();
|
||||
});
|
||||
|
||||
it('treats only a missing config directory as an empty OneBot list', () => {
|
||||
expect(listPerUinOneBotConfigFiles(path.join(root, 'missing'))).toEqual([]);
|
||||
|
||||
const notDirectory = path.join(root, 'not-a-directory');
|
||||
fs.writeFileSync(notDirectory, 'x');
|
||||
expect(() => listPerUinOneBotConfigFiles(notDirectory)).toThrow();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user